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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

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:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy