allow testing metadata in list elements
This commit is contained in:
@@ -262,13 +262,13 @@ class KemonopartyPostExtractor(KemonopartyExtractor):
|
|||||||
"count": 2,
|
"count": 2,
|
||||||
}),
|
}),
|
||||||
# DMs (#2008)
|
# DMs (#2008)
|
||||||
("https://kemono.party/patreon/user/34134344/post/52245464", {
|
("https://kemono.party/patreon/user/34134344/post/38129255", {
|
||||||
"options": (("dms", True),),
|
"options": (("dms", True),),
|
||||||
"keyword": {"dms": [{
|
"keyword": {"dms": [{
|
||||||
"body": r"re:Hi! Thank you very much for supporting the work I"
|
"body": r"re:Hi! Thank you very much for supporting the work I"
|
||||||
r" did in May. Here's your reward pack! I hope you fin"
|
r" did in May. Here's your reward pack! I hope you fin"
|
||||||
r"d something you enjoy in it. :)\n\nhttps://www.media"
|
r"d something you enjoy in it. :\)\n\nhttps://www.medi"
|
||||||
r"fire.com/file/\w+/Set13_tier_2.zip/file",
|
r"afire.com/file/\w+/Set13_tier_2.zip/file",
|
||||||
"date": "2021-07-31 02:47:51.327865",
|
"date": "2021-07-31 02:47:51.327865",
|
||||||
}]},
|
}]},
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -148,6 +148,14 @@ class TestExtractorResults(unittest.TestCase):
|
|||||||
self._test_kwdict(value, test)
|
self._test_kwdict(value, test)
|
||||||
elif isinstance(test, type):
|
elif isinstance(test, type):
|
||||||
self.assertIsInstance(value, test, msg=key)
|
self.assertIsInstance(value, test, msg=key)
|
||||||
|
elif isinstance(test, list):
|
||||||
|
subtest = False
|
||||||
|
for idx, item in enumerate(test):
|
||||||
|
if isinstance(item, dict):
|
||||||
|
subtest = True
|
||||||
|
self._test_kwdict(value[idx], item)
|
||||||
|
if not subtest:
|
||||||
|
self.assertEqual(value, test, msg=key)
|
||||||
elif isinstance(test, str):
|
elif isinstance(test, str):
|
||||||
if test.startswith("re:"):
|
if test.startswith("re:"):
|
||||||
self.assertRegex(value, test[3:], msg=key)
|
self.assertRegex(value, test[3:], msg=key)
|
||||||
|
|||||||
Reference in New Issue
Block a user