summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_calendar.py
diff options
context:
space:
mode:
authorAlex Waygood <Alex.Waygood@Gmail.com>2023-04-30 15:51:46 (GMT)
committerGitHub <noreply@github.com>2023-04-30 15:51:46 (GMT)
commit7d3931e94a76491111a6e391e111cb066236cff4 (patch)
treee36abb37ee5094961e73459b71b4338bb2716bb1 /Lib/test/test_calendar.py
parentf186557dc3e77495ba65b9b7e492ab6ddb7cecc3 (diff)
downloadcpython-7d3931e94a76491111a6e391e111cb066236cff4.zip
cpython-7d3931e94a76491111a6e391e111cb066236cff4.tar.gz
cpython-7d3931e94a76491111a6e391e111cb066236cff4.tar.bz2
gh-104012: Ensure test_calendar.CalendarTestCase.test_deprecation_warning consistently passes (#104014)
Diffstat (limited to 'Lib/test/test_calendar.py')
-rw-r--r--Lib/test/test_calendar.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_calendar.py b/Lib/test/test_calendar.py
index 03388e8..24e472b 100644
--- a/Lib/test/test_calendar.py
+++ b/Lib/test/test_calendar.py
@@ -493,11 +493,11 @@ class OutputTestCase(unittest.TestCase):
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