assert_warning() checks in case of multiple warnings

This commit is contained in:
hugovk 2014-06-07 00:23:55 +03:00
parent 5919c87afb
commit 8693c63173

View File

@ -69,9 +69,13 @@ class PillowTestCase(unittest.TestCase):
result = func() result = func()
# Verify some things. # Verify some things.
self.assertEqual(len(w), 1) self.assertGreaterEqual(len(w), 1)
assert issubclass(w[-1].category, warn_class) found = False
self.assertIn("deprecated", str(w[-1].message)) for v in w:
if issubclass(v.category, warn_class):
found = True
break
self.assertTrue(found)
return result return result
# # require that deprecation warnings are triggered # # require that deprecation warnings are triggered