fix tests
This commit is contained in:
parent
67791e1b36
commit
f79320e35b
@ -17,11 +17,11 @@ class DirectlinkExtractor(Extractor):
|
||||
category = "directlink"
|
||||
directory_fmt = []
|
||||
filename_fmt = "{filename}"
|
||||
pattern = [r"https?://[^?&#]+\.(?:jpe?g|png|gifv?|webm|mp4)"]
|
||||
test = [("https://i.imgur.com/21yMxCS.png", {
|
||||
"url": "6f2dcfb86815bdd72808c313e5f715610bc7b9b2",
|
||||
"keyword": "6a9636d8dd6f71f14d6d20d24153fc83a9895ed9",
|
||||
"content": "0c8768055e4e20e7c7259608b67799171b691140",
|
||||
pattern = [r"https?://[^?&#]+\.(?:jpe?g|png|gif|webm|mp4|ogg)"]
|
||||
test = [(("https://photos.smugmug.com/The-World/Hawaii/"
|
||||
"i-SWz2K6n/2/X3/IMG_0311-X3.jpg"), {
|
||||
"url": "32ee1045881e17ef3f13a9958595afa42421ec6c",
|
||||
"keyword": "5bd7871a6957e1693c43abf31d7c0a38e39a81de",
|
||||
})]
|
||||
|
||||
def __init__(self, match):
|
||||
|
@ -39,8 +39,8 @@ class MangaparkChapterExtractor(Extractor):
|
||||
r"([^/]+/s(\d+)(?:/v([^/]+))?/c(\d+)(?:([^/]+)|/e(\d+))?)")]
|
||||
test = [
|
||||
("http://mangapark.me/manga/gosu/s2/c55", {
|
||||
"url": "fefe84492d9118de5962563fbecb9362051c52d5",
|
||||
"keyword": "652b38c40bdfb5592456b6e7524a3acfdef9fae6",
|
||||
"url": "482d4a27c1e7f03cff8afac145d06f3ddeac82bb",
|
||||
"keyword": "bd97ca24ef344b44292910384215ef3f1005ea2e",
|
||||
}),
|
||||
(("http://mangapark.me/manga/"
|
||||
"ad-astra-per-aspera-hata-kenjirou/s1/c1.2"), {
|
||||
|
@ -25,6 +25,6 @@ class YonkouprodMangaExtractor(foolslide.FoolslideMangaExtractor):
|
||||
"""Extractor for manga from yonkouprod.com"""
|
||||
category = "yonkouprod"
|
||||
pattern = foolslide.manga_pattern(r"(?:www\.)?yonkouprod\.com/reader")
|
||||
test = [("https://yonkouprod.com/reader/series/one-punch-man/", {
|
||||
"url": "e17ed7a2098e2f18e50b64a28a810f62687d05e2",
|
||||
test = [("https://yonkouprod.com/reader/series/attack-on-titan/", {
|
||||
"url": "9d43602ad4a3a8cf65922bf106affa5a6b9523b1",
|
||||
})]
|
||||
|
@ -20,6 +20,12 @@ TESTDATA_FMT = """
|
||||
}})]
|
||||
"""
|
||||
|
||||
TESTDATA_EXCEPTION_FMT = """
|
||||
test = [("{}", {{
|
||||
"exception": "{}",
|
||||
}})]
|
||||
"""
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--content", action="store_true")
|
||||
@ -39,10 +45,18 @@ def main():
|
||||
config.load()
|
||||
for url in urls:
|
||||
tjob = job.TestJob(url, content=args.content)
|
||||
try:
|
||||
tjob.run()
|
||||
except Exception as exc:
|
||||
fmt = TESTDATA_EXCEPTION_FMT
|
||||
data = (exc.__class__.__name__,)
|
||||
else:
|
||||
fmt = TESTDATA_FMT
|
||||
data = (tjob.hash_url.hexdigest(),
|
||||
tjob.hash_keyword.hexdigest(),
|
||||
tjob.hash_content.hexdigest())
|
||||
print(tjob.extractor.__class__.__name__)
|
||||
print(TESTDATA_FMT.format(url, tjob.hash_url.hexdigest(),
|
||||
tjob.hash_keyword.hexdigest(), tjob.hash_content.hexdigest()))
|
||||
print(fmt.format(url, *data))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
Loading…
x
Reference in New Issue
Block a user