MCPcopy Index your code
hub / github.com/python/cpython / test_strptime_leap_year

Method test_strptime_leap_year

Lib/test/datetimetester.py:3123–3134  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3121
3122 @warnings_helper.ignore_warnings(category=DeprecationWarning)
3123 def test_strptime_leap_year(self):
3124 # GH-70647: warns if parsing a format with a day and no year.
3125 with self.assertRaises(ValueError):
3126 # The existing behavior that GH-70647 seeks to change.
3127 self.theclass.strptime('02-29', '%m-%d')
3128 with self.assertWarnsRegex(DeprecationWarning,
3129 r'.*day of month without a year.*'):
3130 self.theclass.strptime('03-14.159265', '%m-%d.%f')
3131 with self._assertNotWarns(DeprecationWarning):
3132 self.theclass.strptime('20-03-14.159265', '%y-%m-%d.%f')
3133 with self._assertNotWarns(DeprecationWarning):
3134 self.theclass.strptime('02-29,2024', '%m-%d,%Y')
3135
3136 def test_strptime_z_empty(self):
3137 for directive in ('z', ':z'):

Callers

nothing calls this directly

Calls 4

assertWarnsRegexMethod · 0.80
_assertNotWarnsMethod · 0.80
assertRaisesMethod · 0.45
strptimeMethod · 0.45

Tested by

no test coverage detected