1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-25 20:22:36 +01:00

support expecting exceptions in tests

This commit is contained in:
Mike Fährmann 2016-12-30 01:41:17 +01:00
parent efdc299547
commit 2c9bc50c23
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -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"])