allow for simplified test data structures

Instead of a strict list of (URL, RESULTS)-tuples, extractor result
tests can now be a single (URL, RESULTS)-tuple, if it's just one test,
and "only matching" tests can now be a simple string.
This commit is contained in:
Mike Fährmann
2019-02-06 17:24:44 +01:00
parent b49c3c9991
commit bc0951d974
7 changed files with 26 additions and 12 deletions

View File

@@ -182,10 +182,8 @@ def generate_tests():
# add 'test_...' methods
for extr in extractors:
if not hasattr(extr, "test") or not extr.test:
continue
name = "test_" + extr.__name__ + "_"
for num, tcase in enumerate(extr.test, 1):
for num, tcase in enumerate(extr._get_tests(), 1):
test = _generate_test(extr, tcase)
test.__name__ = name + str(num)
setattr(TestExtractorResults, test.__name__, test)