The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ

Add a __str__ and __repr__ method to Path

main
Gergely Polonkai 3 months ago
parent fcf9911121
commit 5e57b24200
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4
  1. 6
      earthsnake/path.py
  2. 12
      tests/test_path.py

@ -69,3 +69,9 @@ class Path:
return True
return False
def __str__(self) -> str:
return self.path
def __repr__(self) -> str:
return f'<Path {self.path}>'

@ -94,3 +94,15 @@ def test_can_write(author: str, path: str, allowed: bool) -> None:
identity = Identity.from_address(author)
assert path_obj.can_write(identity) is allowed
def test_str() -> None:
"""Test the __str__ method"""
assert str(Path('/test.txt')) == '/test.txt'
def test_repr() -> None:
"""Test the __repr__ method"""
assert repr(Path('/test.txt')) == '<Path /test.txt>'

Loading…
Cancel
Save