[tests:results] split '_test_kwdict()'

This commit is contained in:
Mike Fährmann
2025-06-07 08:58:00 +02:00
parent 6e120f2551
commit fc01d85823

View File

@@ -235,18 +235,22 @@ class TestExtractorResults(unittest.TestCase):
def _test_kwdict(self, kwdict, tests, parent=None):
for key, test in tests.items():
if key.startswith("?"):
key = key[1:]
if key not in kwdict:
continue
path = "{}.{}".format(parent, key) if parent else key
if key.startswith("!"):
self.assertNotIn(key[1:], kwdict, msg=path)
continue
self.assertIn(key, kwdict, msg=path)
value = kwdict[key]
self.assertIn(key, kwdict, msg=path)
self._test_kwdict_value(kwdict[key], test, path)
def _test_kwdict_value(self, value, test, path):
if isinstance(test, dict):
self._test_kwdict(value, test, path)
elif isinstance(test, type):