MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_strptime_leap_year

Method test_strptime_leap_year

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

Source from the content-addressed store, hash-verified

2966
2967 @warnings_helper.ignore_warnings(category=DeprecationWarning)
2968 def test_strptime_leap_year(self):
2969 # GH-70647: warns if parsing a format with a day and no year.
2970 with self.assertRaises(ValueError):
2971 # The existing behavior that GH-70647 seeks to change.
2972 self.theclass.strptime('02-29', '%m-%d')
2973 with self.assertWarnsRegex(DeprecationWarning,
2974 r'.*day of month without a year.*'):
2975 self.theclass.strptime('03-14.159265', '%m-%d.%f')
2976 with self._assertNotWarns(DeprecationWarning):
2977 self.theclass.strptime('20-03-14.159265', '%y-%m-%d.%f')
2978 with self._assertNotWarns(DeprecationWarning):
2979 self.theclass.strptime('02-29,2024', '%m-%d,%Y')
2980
2981 def test_more_timetuple(self):
2982 # This tests fields beyond those tested by the TestDate.test_timetuple.

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