Browse Source

Fix testing if JSON elements are mappings

Turns out that the JSON objects extend from dict, so this works.
Also turns out that strings have a __getitem__. Who knew?

Done during Turbo Testing & Tooling.
Ghostkeeper 5 years ago
parent
commit
76b5f9d37b
1 changed files with 1 additions and 1 deletions
  1. 1 1
      tests/Settings/TestDefinitionContainer.py

+ 1 - 1
tests/Settings/TestDefinitionContainer.py

@@ -104,7 +104,7 @@ def merge_dicts(base: Dict[str, Any], overrides: Dict[str, Any]) -> Dict[str, An
             result[key] = val
             continue
 
-        if hasattr(result[key], "__getitem__") and hasattr(val, "__getitem__"):  # Duck typing of dicts. Also works with JSON documents for sure.
+        if isinstance(result[key], dict) and isinstance(val, dict):
             result[key] = merge_dicts(result[key], val)
         else:
             result[key] = val