From 2c9bc50c236f4f8852a8a309c83966718eaaf3e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 30 Dec 2016 01:41:17 +0100 Subject: [PATCH] support expecting exceptions in tests --- test/test_extractors.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/test_extractors.py b/test/test_extractors.py index 557a108b..03c13a7a 100644 --- a/test/test_extractors.py +++ b/test/test_extractors.py @@ -19,6 +19,9 @@ class TestExtractors(unittest.TestCase): def run_test(self, extr, url, result): hjob = job.HashJob(url, "content" in result) self.assertEqual(extr, hjob.extractor.__class__) + if "exception" in result: + self.assertRaises(result["exception"], hjob.run) + return hjob.run() if "url" in result: self.assertEqual(hjob.hash_url.hexdigest(), result["url"])