Skip to content

Commit e6b3add

Browse files
committed
Switch from PurePath#as_uri to PurePath#joinpath
`as_uri` is deprecated in `PurePath`. This commit also introduces a test to ensure users have a workaround that is not deprecated.
1 parent 5848b41 commit e6b3add

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/trio/_tests/test_path.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,14 @@ def test_forward_properties_rewrap(path: trio.Path) -> None:
168168
assert isinstance(path.parent, trio.Path)
169169

170170

171-
async def test_forward_methods_without_rewrap(path: trio.Path) -> None:
171+
def test_forward_methods_without_rewrap(path: trio.Path) -> None:
172+
assert "totally-unique-path" in str(path.joinpath("totally-unique-path"))
173+
174+
175+
async def test_path_methods_on_trio_path(path: trio.Path) -> None:
172176
path = await path.parent.resolve()
173177

174-
assert path.as_uri().startswith("file:///")
178+
assert pathlib.Path.as_uri(path).startswith("file:///")
175179

176180

177181
def test_repr() -> None:

src/trio/_tests/type_tests/path.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ 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)
5049
assert_type(path.is_absolute(), bool)
5150
assert_type(path.is_relative_to(path), bool)
5251
assert_type(path.is_reserved(), bool)

0 commit comments

Comments
 (0)