Skip to content

Commit

Permalink
pythonGH-113528: pathlib ABC tests: add repr to dummy path classes. (p…
Browse files Browse the repository at this point in the history
…ython#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.
  • Loading branch information
barneygale authored and Glyphack committed Jan 27, 2024
1 parent aca495d commit c7cc820
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 c7cc820

Please sign in to comment.