From: Benjamin Peterson Date: Fri, 9 Jul 2010 18:15:28 +0000 (+0000) Subject: this makes checking for warnings less error prone X-Git-Tag: v2.7.1rc1~623 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8e93f4e791d9e0fab7a40d1c95f5071f166f8390;p=python this makes checking for warnings less error prone --- diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py index 16c2b9e2ce..816cedbb11 100644 --- a/Lib/test/test_struct.py +++ b/Lib/test/test_struct.py @@ -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,