mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 18:53:21 +01:00
[test:extractor] small fixes and improvements
This commit is contained in:
parent
792135a339
commit
c9e6ccbd7c
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
import string
|
||||||
|
|
||||||
import gallery_dl.extractor as extractor
|
import gallery_dl.extractor as extractor
|
||||||
from gallery_dl.extractor.common import Extractor, Message
|
from gallery_dl.extractor.common import Extractor, Message
|
||||||
@ -118,7 +119,6 @@ class TestExtractor(unittest.TestCase):
|
|||||||
|
|
||||||
match = pattern.match(url)
|
match = pattern.match(url)
|
||||||
if match:
|
if match:
|
||||||
self.assertEqual(extr1, extr2)
|
|
||||||
matches.append(match)
|
matches.append(match)
|
||||||
|
|
||||||
# fail if more or less than 1 match happened
|
# fail if more or less than 1 match happened
|
||||||
@ -146,6 +146,11 @@ class TestExtractor(unittest.TestCase):
|
|||||||
|
|
||||||
def test_names(self):
|
def test_names(self):
|
||||||
"""Ensure extractor classes are named CategorySubcategoryExtractor"""
|
"""Ensure extractor classes are named CategorySubcategoryExtractor"""
|
||||||
|
def capitalize(c):
|
||||||
|
if "-" in c:
|
||||||
|
return string.capwords(c.replace("-", " ")).replace(" ", "")
|
||||||
|
return c.capitalize()
|
||||||
|
|
||||||
mapping = {
|
mapping = {
|
||||||
"2chan" : "futaba",
|
"2chan" : "futaba",
|
||||||
"3dbooru": "threedeebooru",
|
"3dbooru": "threedeebooru",
|
||||||
@ -155,15 +160,14 @@ class TestExtractor(unittest.TestCase):
|
|||||||
"b4k" : "bfourk",
|
"b4k" : "bfourk",
|
||||||
"oauth" : None,
|
"oauth" : None,
|
||||||
"rbt" : "rebeccablacktech",
|
"rbt" : "rebeccablacktech",
|
||||||
"whatisthisimnotgoodwithcomputers": "witingwc",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for extr in extractor.extractors():
|
for extr in extractor.extractors():
|
||||||
category = mapping.get(extr.category, extr.category)
|
category = mapping.get(extr.category, extr.category)
|
||||||
if category:
|
if category:
|
||||||
expected = "{}{}Extractor".format(
|
expected = "{}{}Extractor".format(
|
||||||
category.capitalize(),
|
capitalize(category),
|
||||||
extr.subcategory.capitalize(),
|
capitalize(extr.subcategory),
|
||||||
)
|
)
|
||||||
self.assertEqual(expected, extr.__name__)
|
self.assertEqual(expected, extr.__name__)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user