diff --git a/Lib/test/test_calendar.py b/Lib/test/test_calendar.py index 03388e8c55d5a8..24e472b5fee828 100644 --- a/Lib/test/test_calendar.py +++ b/Lib/test/test_calendar.py @@ -493,11 +493,11 @@ def test_format(self): class CalendarTestCase(unittest.TestCase): def test_deprecation_warning(self): - with warnings.catch_warnings(record=True) as w: + with self.assertWarnsRegex( + DeprecationWarning, + "The 'January' attribute is deprecated, use 'JANUARY' instead" + ): calendar.January - self.assertEqual(len(w), 1) - self.assertEqual(w[0].category, DeprecationWarning) - self.assertIn("The 'January' attribute is deprecated, use 'JANUARY' instead", str(w[0].message)) def test_isleap(self): # Make sure that the return is right for a few years, and
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: