1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 10:42:34 +01:00

allow testing metadata in list elements

This commit is contained in:
Mike Fährmann 2021-11-21 22:46:34 +01:00
parent c67756e187
commit af6424f398
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 11 additions and 3 deletions

View File

@ -262,13 +262,13 @@ class KemonopartyPostExtractor(KemonopartyExtractor):
"count": 2,
}),
# DMs (#2008)
("https://kemono.party/patreon/user/34134344/post/52245464", {
("https://kemono.party/patreon/user/34134344/post/38129255", {
"options": (("dms", True),),
"keyword": {"dms": [{
"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"d something you enjoy in it. :)\n\nhttps://www.media"
r"fire.com/file/\w+/Set13_tier_2.zip/file",
r"d something you enjoy in it. :\)\n\nhttps://www.medi"
r"afire.com/file/\w+/Set13_tier_2.zip/file",
"date": "2021-07-31 02:47:51.327865",
}]},
}),

View File

@ -148,6 +148,14 @@ class TestExtractorResults(unittest.TestCase):
self._test_kwdict(value, test)
elif isinstance(test, type):
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):
if test.startswith("re:"):
self.assertRegex(value, test[3:], msg=key)