8000 gh-104012: Ensure test_calendar.CalendarTestCase.test_deprecation_war… · python/cpython@7d3931e · GitHub
[go: up one dir, main page]

Skip to content

Commit 7d3931e

Browse files
authored
gh-104012: Ensure test_calendar.CalendarTestCase.test_deprecation_warning consistently passes (#104014)
1 parent f186557 commit 7d3931e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Lib/test/test_calendar.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,11 +493,11 @@ def test_format(self):
493493
class CalendarTestCase(unittest.TestCase):
494494

495495
def test_deprecation_warning(self):
496-
with warnings.catch_warnings(record=True) as w:
496+
with self.assertWarnsRegex(
497+
DeprecationWarning,
498+
"The 'January' attribute is deprecated, use 'JANUARY' instead"
499+
):
497500
calendar.January
498-
self.assertEqual(len(w), 1)
499-
self.assertEqual(w[0].category, DeprecationWarning)
500-
self.assertIn("The 'January' attribute is deprecated, use 'JANUARY' instead", str(w[0].message))
501501

502502
def test_isleap(self):
503503
# Make sure that the return is right for a few years, and

0 commit comments

Comments
 (0)
0