[tests:results] split '_test_kwdict()'
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user