Skip to content

Commit eeebf51

Browse files
authored
upath: fix is_absolute on <3.12 (#256)
1 parent 65cbe0e commit eeebf51

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

upath/core.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,9 @@ def home(cls) -> UPath:
945945
def absolute(self) -> Self:
946946
return self
947947

948+
def is_absolute(self) -> bool:
949+
return self._flavour.isabs(str(self))
950+
948951
def resolve(self, strict: bool = False) -> Self:
949952
_parts = self.parts
950953

upath/tests/cases.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ def test_is_file(self):
115115

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

118+
def test_is_absolute(self):
119+
assert self.path.is_absolute() is True
120+
118121
def test_is_mount(self):
119122
assert self.path.is_mount() is False
120123

0 commit comments

Comments
 (0)