Skip to content

Commit

Permalink
pythonGH-113528: pathlib ABC tests: add repr to dummy path classes.
Browse files Browse the repository at this point in the history
The `DummyPurePath` and `DummyPath` test classes are simple subclasses of
`PurePathBase` and `Pathbase`. This commit adds `__repr__()` methods to the
dummy classes, which makes debugging test failures less painful.
  • Loading branch information
barneygale committed Jan 6, 2024
1 parent 3375dfe commit 133a76b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Lib/test/test_pathlib/test_pathlib_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ def __eq__(self, other):
def __hash__(self):
return hash(str(self))

def __repr__(self):
return "{}({!r})".format(self.__class__.__name__, self.as_posix())


class DummyPurePathTest(unittest.TestCase):
cls = DummyPurePath
Expand Down Expand Up @@ -719,6 +722,9 @@ def __eq__(self, other):
def __hash__(self):
return hash(str(self))

def __repr__(self):
return "{}({!r})".format(self.__class__.__name__, self.as_posix())

def stat(self, *, follow_symlinks=True):
if follow_symlinks:
path = str(self.resolve())
Expand Down

0 comments on commit 133a76b

Please sign in to comment.