mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-25 04:02:32 +01:00
[tests] support one regex per URL for #pattern
This commit is contained in:
parent
be17103e21
commit
bd3f7a5bbc
@ -9,15 +9,31 @@ from gallery_dl.extractor import redgifs
|
||||
|
||||
__tests__ = (
|
||||
{
|
||||
"#url" : "https://www.redgifs.com/users/Natalifiction",
|
||||
"#url" : "https://www.redgifs.com/users/mmj",
|
||||
"#category": ("", "redgifs", "user"),
|
||||
"#class" : redgifs.RedgifsUserExtractor,
|
||||
"#pattern" : r"https://\w+\.redgifs\.com/[\w-]+\.mp4",
|
||||
"#count" : ">= 100",
|
||||
"#count" : range(50, 60),
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.redgifs.com/users/mmj?order=old",
|
||||
"#comment" : "'order' URL parameter (#4583)",
|
||||
"#category": ("", "redgifs", "user"),
|
||||
"#class" : redgifs.RedgifsUserExtractor,
|
||||
"#range" : "1-5",
|
||||
"#patterns": (
|
||||
r"https://thumbs\d+\.redgifs\.com/ShoddyOilyHarlequinbug\.mp4",
|
||||
r"https://thumbs\d+\.redgifs\.com/UnevenPrestigiousKilldeer\.mp4",
|
||||
r"https://thumbs\d+\.redgifs\.com/EveryShockingFlickertailsquirrel\.mp4",
|
||||
r"https://thumbs\d+\.redgifs\.com/NegativeWarlikeAmericancurl\.mp4",
|
||||
r"https://thumbs\d+\.redgifs\.com/PopularTerribleFritillarybutterfly\.mp4",
|
||||
),
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://v3.redgifs.com/users/lamsinka89",
|
||||
"#comment" : "'v3' subdomain (#3588, #3589)",
|
||||
"#category": ("", "redgifs", "user"),
|
||||
"#class" : redgifs.RedgifsUserExtractor,
|
||||
"#pattern" : r"https://\w+\.redgifs\.com/[\w-]+\.(mp4|jpg)",
|
||||
|
@ -148,8 +148,13 @@ class TestExtractorResults(unittest.TestCase):
|
||||
|
||||
if "#pattern" in result:
|
||||
self.assertGreater(len(tjob.url_list), 0)
|
||||
for url in tjob.url_list:
|
||||
self.assertRegex(url, result["#pattern"])
|
||||
pattern = result["#pattern"]
|
||||
if isinstance(pattern, str):
|
||||
for url in tjob.url_list:
|
||||
self.assertRegex(url, pattern, msg="#pattern")
|
||||
else:
|
||||
for url, pat in zip(tjob.url_list, pattern):
|
||||
self.assertRegex(url, pat, msg="#pattern")
|
||||
|
||||
if "#urls" in result:
|
||||
expected = result["#urls"]
|
||||
|
Loading…
Reference in New Issue
Block a user