diff --git a/HISTORY.rst b/HISTORY.rst index 08af269..01497c0 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,7 @@ tnefparse 1.4.0 (unreleased) - add Python 3.9 support (jugmac00) - introduce using type annotations (jugmac00) - remove deprecated parseFile & raw_mapi functions +- fix str representation for TNEF class (jugmac00) tnefparse 1.3.1 (2020-09-30) ============================= diff --git a/tests/test_tnef.py b/tests/test_tnef.py new file mode 100644 index 0000000..42ebec7 --- /dev/null +++ b/tests/test_tnef.py @@ -0,0 +1,11 @@ +import os +from tnefparse.tnef import TNEF + +THIS_DIR = os.path.dirname(os.path.abspath(__file__)) + + +def test_tnef_str_representation(): + tnef_data = open(os.path.join(THIS_DIR, "examples", "two-files.tnef"), mode="rb").read() + t = TNEF(tnef_data) + + assert str(t) == "" diff --git a/tnefparse/tnef.py b/tnefparse/tnef.py index bfc8f8b..082c4d3 100644 --- a/tnefparse/tnef.py +++ b/tnefparse/tnef.py @@ -337,7 +337,7 @@ def rtfbody(self): def __str__(self): atts = (", %i attachments" % len(self.attachments)) if self.attachments else '' - return f"<{self.__class__.__name__}:0x{self.key:2.2x}{atts}>" + return f"<{self.__class__.__name__}:0x{self.key:02x}{atts}>" def dump(self, force_strings=False): def get_data(a):