diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py index 1f5d05fb8a1..71944cd1532 100644 --- a/Lib/test/test_warnings.py +++ b/Lib/test/test_warnings.py @@ -347,8 +347,7 @@ class WarnTests(unittest.TestCase): return ("A bad formatted string %(err)" % {"err" : "there is no %(err)s"}) - with self.assertRaises(ValueError): - self.module.warn(BadStrWarning()) + self.assertRaises(ValueError, self.module.warn, BadStrWarning()) class CWarnTests(BaseTest, WarnTests):