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:
244
244
if sys .version_info >= (3 , 13 ):
245
245
full_match = _wrap_method (pathlib .Path .full_match )
246
246
247
+ def as_uri (self ) -> str :
248
+ return pathlib .Path .as_uri (self )
249
+
247
250
248
251
@final
249
252
class 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:
172
172
assert "totally-unique-path" in str (path .joinpath ("totally-unique-path" ))
173
173
174
174
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
-
181
175
def test_repr () -> None :
182
176
path = trio .Path ("." )
183
177
@@ -236,6 +230,12 @@ async def test_globmethods(path: trio.Path) -> None:
236
230
assert entries == {"_bar.txt" , "bar.txt" }
237
231
238
232
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
+
239
239
async def test_iterdir (path : trio .Path ) -> None :
240
240
# Populate a directory
241
241
await path .mkdir ()
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ def sync_attrs(path: trio.Path) -> None:
46
46
assert_type (path .suffixes , list [str ])
47
47
assert_type (path .stem , str )
48
48
assert_type (path .as_posix (), str )
49
+ assert_type (path .as_uri (), str )
49
50
assert_type (path .is_absolute (), bool )
50
51
assert_type (path .is_relative_to (path ), bool )
51
52
assert_type (path .is_reserved (), bool )
You can’t perform that action at this time.
0 commit comments