From 60b5ed88f3243c700b94ab0c5c762a0cc7384707 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Wed, 14 Nov 2012 06:21:59 +0100 Subject: [PATCH] Test stripUrl. --- tests/test_comics.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/test_comics.py b/tests/test_comics.py index af7d2432b..753f28f80 100644 --- a/tests/test_comics.py +++ b/tests/test_comics.py @@ -28,11 +28,14 @@ class _ComicTester(TestCase): for image in strip.getImages(): images += 1 self.save(image) - if images: + if num > 0: # test that the stripUrl regex matches the retrieved strip URL - urlmatch = re.escape(self.scraperclass.stripUrl).replace("%s", r".+") - mo = re.compile(urlmatch).match(strip.stripUrl) - self.check(mo is not None, 'strip URL %r does not match %r' % (strip.stripUrl, self.scraperclass.stripUrl)) + urlmatch = re.escape(self.scraperclass.stripUrl) + urlmatch = urlmatch.replace(r"\%s", r".+") + urlmatch = "^%s$" % urlmatch + ro = re.compile(urlmatch) + mo = ro.search(strip.stripUrl) + self.check(mo is not None, 'strip URL %r does not match %s' % (strip.stripUrl, urlmatch)) else: empty += 1 num += 1