Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7d3931e

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

File tree

1 file changed

+4
-4
lines changed
Filter options

1 file changed

+4
-4
lines changed

‎Lib/test/test_calendar.py

Copy file name to clipboardExpand all lines: Lib/test/test_calendar.py
+4-4Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.