allow type tests by name
This commit is contained in:
parent
df7cdb648a
commit
5018781898
@ -119,8 +119,13 @@ class TestExtractorResults(unittest.TestCase):
|
||||
self._test_kwdict(value, test)
|
||||
elif isinstance(test, type):
|
||||
self.assertIsInstance(value, test, msg=key)
|
||||
elif isinstance(test, str) and test.startswith("re:"):
|
||||
self.assertRegex(value, test[3:], msg=key)
|
||||
elif isinstance(test, str):
|
||||
if test.startswith("re:"):
|
||||
self.assertRegex(value, test[3:], msg=key)
|
||||
elif test.startswith("type:"):
|
||||
self.assertEqual(type(value).__name__, test[5:], msg=key)
|
||||
else:
|
||||
self.assertEqual(value, test, msg=key)
|
||||
else:
|
||||
self.assertEqual(value, test, msg=key)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user