Skip to content

Commit d429a5a

Browse files
authored
GH-113528: pathlib ABC tests: add repr to dummy path classes. (#113777)
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.
1 parent d36a365 commit d429a5a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Lib/test/test_pathlib/test_pathlib_abc.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ def __eq__(self, other):
5151
def __hash__(self):
5252
return hash(str(self))
5353

54+
def __repr__(self):
55+
return "{}({!r})".format(self.__class__.__name__, self.as_posix())
56+
5457

5558
class DummyPurePathTest(unittest.TestCase):
5659
cls = DummyPurePath
@@ -719,6 +722,9 @@ def __eq__(self, other):
719722
def __hash__(self):
720723
return hash(str(self))
721724

725+
def __repr__(self):
726+
return "{}({!r})".format(self.__class__.__name__, self.as_posix())
727+
722728
def stat(self, *, follow_symlinks=True):
723729
if follow_symlinks:
724730
path = str(self.resolve())

0 commit comments

Comments
 (0)