mirror of https://github.com/python/cpython
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:
parent
d36a365118
commit
d429a5a8e7
|
@ -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())
|
||||
|
|
Loading…
Reference in New Issue