[tests] allow testing for types + values

This commit is contained in:
Mike Fährmann
2025-01-12 19:17:46 +01:00
parent 2b46b82f9c
commit 42070240ae
2 changed files with 4 additions and 1 deletions

View File

@@ -50,7 +50,10 @@ __tests__ = (
"following" : False, "following" : False,
"hero" : bool, "hero" : bool,
"id" : int, "id" : int,
"last_name" : {str, None},
"location" : {str, None},
"slug" : str, "slug" : str,
"username" : {str, None},
}, },
}, },

View File

@@ -237,7 +237,7 @@ class TestExtractorResults(unittest.TestCase):
elif isinstance(test, range): elif isinstance(test, range):
self.assertRange(value, test, msg=path) self.assertRange(value, test, msg=path)
elif isinstance(test, set): elif isinstance(test, set):
self.assertIn(value, test, msg=path) self.assertTrue(value in test or type(value) in test, msg=path)
elif isinstance(test, list): elif isinstance(test, list):
subtest = False subtest = False
for idx, item in enumerate(test): for idx, item in enumerate(test):