[tests] allow testing for types + values
This commit is contained in:
@@ -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},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -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):
|
||||||
|
|||||||
Reference in New Issue
Block a user