]> granicus.if.org Git - python/commitdiff
this makes checking for warnings less error prone
authorBenjamin Peterson <benjamin@python.org>
Fri, 9 Jul 2010 18:15:28 +0000 (18:15 +0000)
committerBenjamin Peterson <benjamin@python.org>
Fri, 9 Jul 2010 18:15:28 +0000 (18:15 +0000)
Lib/test/test_struct.py

index 16c2b9e2ce294bc8c55f3f628897f62e5e8be0bf..816cedbb11dfe78ddefa90f80bb85e5a52337e68 100644 (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,