diff options
author | Barney Gale <barney.gale@gmail.com> | 2024-01-06 17:02:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-06 17:02:36 (GMT) |
commit | d429a5a8e76e3013b35d60c78fcb891556ad9a7c (patch) | |
tree | 16e1bb2a6e172be404259955b9a008224dc917cf | |
parent | d36a36511899bd8dc9adf5fc354e8ff7c611c51d (diff) | |
download | cpython-d429a5a8e76e3013b35d60c78fcb891556ad9a7c.zip cpython-d429a5a8e76e3013b35d60c78fcb891556ad9a7c.tar.gz cpython-d429a5a8e76e3013b35d60c78fcb891556ad9a7c.tar.bz2 |
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.
-rw-r--r-- | Lib/test/test_pathlib/test_pathlib_abc.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_pathlib/test_pathlib_abc.py b/Lib/test/test_pathlib/test_pathlib_abc.py index 3a7c036..bfde5f3 100644 --- a/Lib/test/test_pathlib/test_pathlib_abc.py +++ b/Lib/test/test_pathlib/test_pathlib_abc.py @@ -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()) |