Add a __repr__ method to Document
This commit is contained in:
parent
ae99aba0e0
commit
b0a7719bf1
@ -30,3 +30,6 @@ class Document(ABC): # pragma: no cover pylint: disable=too-few-public-methods
|
||||
|
||||
If ``identity`` is ``None``, use ``self.author`` instead.
|
||||
"""
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f'<{self.__class__.__name__} {self.path} by {self.author}>'
|
||||
|
@ -257,3 +257,12 @@ def test_content_length(es4_document: Es4Document) -> None:
|
||||
"""Test the content_length property"""
|
||||
|
||||
assert es4_document.content_length == 4
|
||||
|
||||
|
||||
def test_repr(es4_document: Es4Document) -> None:
|
||||
"""Test the __repr__ method of Es4Document"""
|
||||
|
||||
assert (
|
||||
repr(es4_document)
|
||||
== '<Es4Document /test.txt by @test.bcz76z52y5dlpohtkmpuj3jsdcvfmebzpcgfmtmhu4u7hlexzreya>'
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user