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.
This commit is contained in:
Barney Gale 2024-01-06 17:02:36 +00:00 committed by GitHub
parent d36a365118
commit d429a5a8e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -51,6 +51,9 @@ class DummyPurePath(PurePathBase):
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
@ -719,6 +722,9 @@ class DummyPath(PathBase):
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())