test_parser.py: Fail on missing keys feature/test-missing-keys
authorEgon Kidmose <kidmose@gmail.com>
Thu, 15 Feb 2018 15:00:18 +0100
branchfeature/test-missing-keys
changeset 166 6cbe4891d62a
parent 163 faaa3ce1af3e
child 167 7bec7a730d69
test_parser.py: Fail on missing keys
test/test_parser.py
--- a/test/test_parser.py	Mon Feb 05 19:47:43 2018 +0000
+++ b/test/test_parser.py	Thu Feb 15 15:00:18 2018 +0100
@@ -85,8 +85,13 @@
                 expected_results = json.load(infil)
 
             # Compare each key
-            for key in results:
+            for key in set(results).union(set(expected_results)):
                 total += 1
+                if key not in results:
+                    print("%s \t(%s):\t Missing in results" % (domain, key,))
+                    fail += 1
+                    continue
+                
                 result = results.get(key)
                 if isinstance(result, list):
                     result = [str(element) for element in result]