File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed
Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -244,6 +244,9 @@ def __repr__(self) -> str:
244244 if sys .version_info >= (3 , 13 ):
245245 full_match = _wrap_method (pathlib .Path .full_match )
246246
247+ def as_uri (self ) -> str :
248+ return pathlib .Path .as_uri (self )
249+
247250
248251@final
249252class PosixPath (Path , pathlib .PurePosixPath ):
Original file line number Diff line number Diff line change @@ -172,12 +172,6 @@ def test_forward_methods_without_rewrap(path: trio.Path) -> None:
172172 assert "totally-unique-path" in str (path .joinpath ("totally-unique-path" ))
173173
174174
175- async def test_path_methods_on_trio_path (path : trio .Path ) -> None :
176- path = await path .parent .resolve ()
177-
178- assert pathlib .Path .as_uri (path ).startswith ("file:///" )
179-
180-
181175def test_repr () -> None :
182176 path = trio .Path ("." )
183177
@@ -236,6 +230,12 @@ async def test_globmethods(path: trio.Path) -> None:
236230 assert entries == {"_bar.txt" , "bar.txt" }
237231
238232
233+ async def test_as_uri (path : trio .Path ) -> None :
234+ path = await path .parent .resolve ()
235+
236+ assert path .as_uri ().startswith ("file:///" )
237+
238+
239239async def test_iterdir (path : trio .Path ) -> None :
240240 # Populate a directory
241241 await path .mkdir ()
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ def sync_attrs(path: trio.Path) -> None:
4646 assert_type (path .suffixes , list [str ])
4747 assert_type (path .stem , str )
4848 assert_type (path .as_posix (), str )
49+ assert_type (path .as_uri (), str )
4950 assert_type (path .is_absolute (), bool )
5051 assert_type (path .is_relative_to (path ), bool )
5152 assert_type (path .is_reserved (), bool )
You can’t perform that action at this time.
0 commit comments