File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -722,6 +722,9 @@ def parents(self) -> _UPathParents:
722722 """A sequence of this upath's logical parents."""
723723 return _UPathParents (self )
724724
725+ def as_uri (self ) -> str :
726+ return str (self )
727+
725728
726729class _UPathParents (Sequence [UPath ]):
727730 """This object provides sequence-like access to the logical ancestors
Original file line number Diff line number Diff line change @@ -408,4 +408,11 @@ def test_private_url_attr_in_sync(self):
408408 p1 = self .path .joinpath ("c" )
409409 p2 = self .path / "c"
410410 assert p1 ._url == p2 ._url
411- assert p1 != p ._url
411+ assert p1 ._url != p ._url
412+
413+ def test_as_uri (self ):
414+ # test that we can reconstruct the path from the uri
415+ p0 = self .path
416+ uri = p0 .as_uri ()
417+ p1 = UPath (uri , ** p0 .fs .storage_options )
418+ assert p0 == p1
You can’t perform that action at this time.
0 commit comments