From 8675706c9385f9a085bfbe568636ee878f68bef1 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Fri, 5 Oct 2018 12:35:35 +0200 Subject: [PATCH] Improve the display of mat2 when no metadata are found This should close #74 --- mat2 | 7 ++++++- tests/test_climat2.py | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mat2 b/mat2 index 272cd8f..a49b110 100755 --- a/mat2 +++ b/mat2 @@ -63,7 +63,12 @@ def show_meta(filename: str): return print("[+] Metadata for %s:" % filename) - for k, v in p.get_meta().items(): + meta = p.get_meta().items() + if not meta: + print(" No metadata found") + return + + for k, v in meta: try: # FIXME this is ugly. print(" %s: %s" % (k, v)) except UnicodeEncodeError: diff --git a/tests/test_climat2.py b/tests/test_climat2.py index a1f141c..9bb4ba3 100644 --- a/tests/test_climat2.py +++ b/tests/test_climat2.py @@ -81,6 +81,7 @@ class TestCleanFolder(unittest.TestCase): stdout=subprocess.PIPE) stdout, _ = proc.communicate() self.assertNotIn(b'Comment: Created with GIMP', stdout) + self.assertIn(b'No metadata found', stdout) shutil.rmtree('./tests/data/folder/')