From 8e93f4e791d9e0fab7a40d1c95f5071f166f8390 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Fri, 9 Jul 2010 18:15:28 +0000 Subject: [PATCH] this makes checking for warnings less error prone --- Lib/test/test_struct.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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, -- 2.50.1