diff --git a/upath/core.py b/upath/core.py index a1ecfd4c..9a84f21c 100644 --- a/upath/core.py +++ b/upath/core.py @@ -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 diff --git a/upath/tests/cases.py b/upath/tests/cases.py index d7e80fb8..d865d537 100644 --- a/upath/tests/cases.py +++ b/upath/tests/cases.py @@ -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