this makes checking for warnings less error prone

This commit is contained in:
Benjamin Peterson 2010-07-09 18:15:28 +00:00
parent 0b00b6b987
commit 8e93f4e791

View file

@ -317,9 +317,8 @@ class StructTest(unittest.TestCase):
randrange)
with check_warnings(("integer argument expected, "
"got non-integer", DeprecationWarning)):
self.assertRaises((TypeError, struct.error),
struct.pack, self.format,
3+42j)
with self.assertRaises((TypeError, struct.error)):
struct.pack(self.format, 3+42j)
# an attempt to convert a non-integer (with an
# implicit conversion via __int__) should succeed,