Skip to content

Commit 70b1a78

Browse files
authored
feat: expanduser no-op (#293)
* feat: expanduser no-op * test: expanduser for pathlib paths * chore: undo autoformatting
1 parent 6450ef8 commit 70b1a78

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

upath/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1072,4 +1072,4 @@ def hardlink_to( # type: ignore[override]
10721072
raise NotImplementedError
10731073

10741074
def expanduser(self) -> Self:
1075-
raise NotImplementedError
1075+
return self

upath/tests/cases.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ def test_exists(self, url, expected):
6565
assert path.exists() == expected
6666

6767
def test_expanduser(self):
68-
with pytest.raises(NotImplementedError):
69-
self.path.expanduser()
68+
assert self.path.expanduser() == self.path
7069

7170
@pytest.mark.parametrize(
7271
"pattern",

upath/tests/test_core.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,3 +445,8 @@ def test_joinpath_on_protocol_mismatch(base, join):
445445
)
446446
def test_joinuri_on_protocol_mismatch(base, join):
447447
assert UPath(base).joinuri(UPath(join)) == UPath(join)
448+
449+
450+
def test_upath_expanduser():
451+
assert UPath("~").expanduser() == UPath(os.path.expanduser("~"))
452+
assert UPath("~") != UPath("~").expanduser()

0 commit comments

Comments
 (0)