Skip to content

Commit

Permalink
upath: fix is_absolute on <3.12 (#256)
Browse files Browse the repository at this point in the history
  • Loading branch information
ap-- authored Aug 23, 2024
1 parent 65cbe0e commit eeebf51
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions upath/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,9 @@ def home(cls) -> UPath:
def absolute(self) -> Self:
return self

def is_absolute(self) -> bool:
return self._flavour.isabs(str(self))

def resolve(self, strict: bool = False) -> Self:
_parts = self.parts

Expand Down
3 changes: 3 additions & 0 deletions upath/tests/cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ def test_is_file(self):

assert not (self.path / "not-existing-file.txt").is_file()

def test_is_absolute(self):
assert self.path.is_absolute() is True

def test_is_mount(self):
assert self.path.is_mount() is False

Expand Down

0 comments on commit eeebf51

Please sign in to comment.