add a few tests expecting exceptions

This commit is contained in:
Mike Fährmann
2016-12-30 01:46:42 +01:00
parent 2c9bc50c23
commit 7952b8d18d
4 changed files with 47 additions and 18 deletions

View File

@@ -34,7 +34,10 @@ class MangamintMangaExtractor(MangamintExtractor):
"url": "df7a1f4224d23e392ec09d4c7bbd4fbc873327d0",
}),
("https://www.mangamint.com/manga/gosu-manhwa", {
"url": "555a2e42a1e10c54ce3439090807af9c2354d890",
"url": "6d06633cf3d5f9bd9f2c2b42918be853d6e0c395",
}),
("https://www.mangamint.com/manga/gosu", {
"exception": exception.NotFoundError,
}),
]
@@ -75,6 +78,9 @@ class MangamintChapterExtractor(MangamintExtractor):
"keyword": "f862c1d927d331a016e306305534d38d877aa3fe",
"content": "8d7ae90e932dc2fa48163497fca78729b2c7a759",
}),
("https://www.mangamint.com/gosu-552", {
"exception": exception.NotFoundError,
}),
]
def items(self):

View File

@@ -78,10 +78,15 @@ class NijieUserExtractor(NijieExtractor):
subcategory = "user"
pattern = [(r"(?:https?://)?(?:www\.)?nijie\.info/"
r"members(?:_illust)?\.php\?id=(\d+)")]
test = [("https://nijie.info/members_illust.php?id=44", {
"url": "585d821df4716b1098660a0be426d01db4b65f2a",
"keyword": "7a2dbf8fc0dfdb2af208ecdb8ec7f3186bdc31ab",
})]
test = [
("https://nijie.info/members_illust.php?id=44", {
"url": "585d821df4716b1098660a0be426d01db4b65f2a",
"keyword": "7a2dbf8fc0dfdb2af208ecdb8ec7f3186bdc31ab",
}),
("https://nijie.info/members_illust.php?id=43", {
"exception": exception.NotFoundError,
}),
]
def __init__(self, match):
NijieExtractor.__init__(self)
@@ -90,7 +95,7 @@ class NijieUserExtractor(NijieExtractor):
+ self.artist_id)
def get_image_ids(self):
response = self.request(self.artist_url)
response = self.session.get(self.artist_url)
if response.status_code == 404:
raise exception.NotFoundError("artist")
return list(text.extract_iter(response.text, ' illust_id="', '"'))
@@ -100,11 +105,16 @@ class NijieImageExtractor(NijieExtractor):
"""Extractor for a work/image from nijie.info"""
subcategory = "image"
pattern = [r"(?:https?://)?(?:www\.)?nijie\.info/view\.php\?id=(\d+)"]
test = [("https://nijie.info/view.php?id=70720", {
"url": "a10d4995645b5f260821e32c60a35f73546c2699",
"keyword": "e454c2bad9b636b90d569881bf4fe8438506e0d2",
"content": "d85e3ea896ed5e4da0bca2390ad310a4df716ca6",
})]
test = [
("https://nijie.info/view.php?id=70720", {
"url": "a10d4995645b5f260821e32c60a35f73546c2699",
"keyword": "e454c2bad9b636b90d569881bf4fe8438506e0d2",
"content": "d85e3ea896ed5e4da0bca2390ad310a4df716ca6",
}),
("https://nijie.info/view.php?id=70724", {
"exception": exception.NotFoundError,
}),
]
def __init__(self, match):
NijieExtractor.__init__(self)

View File

@@ -21,9 +21,14 @@ class PixivUserExtractor(Extractor):
directory_fmt = ["{category}", "{artist-id}-{artist-nick}"]
filename_fmt = "{category}_{artist-id}_{id}{num}.{extension}"
pattern = [r"(?:https?://)?(?:www\.)?pixiv\.net/member(?:_illust)?\.php\?id=(\d+)"]
test = [("http://www.pixiv.net/member_illust.php?id=173530", {
"url": "8f2fc0437e2095ab750c4340a4eba33ec6269477",
})]
test = [
("http://www.pixiv.net/member_illust.php?id=173530", {
"url": "8f2fc0437e2095ab750c4340a4eba33ec6269477",
}),
("http://www.pixiv.net/member_illust.php?id=173531", {
"exception": exception.NotFoundError,
}),
]
member_url = "http://www.pixiv.net/member_illust.php"
illust_url = "http://www.pixiv.net/member_illust.php?mode=medium"
@@ -148,6 +153,9 @@ class PixivWorkExtractor(PixivUserExtractor):
"url": "efb622f065b0871e92195e7bee0b4d75bd687d8d",
"content": "69a8edfb717400d1c2e146ab2b30d2c235440c5a",
}),
("http://www.pixiv.net/member_illust.php?mode=medium&illust_id=966411", {
"exception": exception.NotFoundError,
}),
("http://i1.pixiv.net/c/600x600/img-master/img/2008/06/13/00/29/13/966412_p0_master1200.jpg", {
"url": "efb622f065b0871e92195e7bee0b4d75bd687d8d",
}),

View File

@@ -22,10 +22,15 @@ class SeigaImageExtractor(Extractor):
r"(?:seiga/im|image/source/)(\d+)"),
(r"(?:https?://)?lohas\.nicoseiga\.jp/"
r"(?:priv|o)/[^/]+/\d+/(\d+)")]
test = [("http://seiga.nicovideo.jp/seiga/im5977527", {
"keyword": "fd2628b573d15d1bbdefb219a99b993365b214ed",
"content": "d9202292012178374d57fb0126f6124387265297",
})]
test = [
("http://seiga.nicovideo.jp/seiga/im5977527", {
"keyword": "fd2628b573d15d1bbdefb219a99b993365b214ed",
"content": "d9202292012178374d57fb0126f6124387265297",
}),
("http://seiga.nicovideo.jp/seiga/im123", {
"exception": exception.NotFoundError,
}),
]
def __init__(self, match):
Extractor.__init__(self)