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

Method test_strptime_ampm

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

Source from the content-addressed store, hash-verified

3076 with self.assertRaises(ValueError): strptime("z", "%z")
3077
3078 def test_strptime_ampm(self):
3079 dt = datetime(1999, 3, 17, 0, 44, 55, 2)
3080 for hour in range(0, 24):
3081 with self.subTest(hour=hour):
3082 new_dt = dt.replace(hour=hour)
3083 dt_str = new_dt.strftime("%I %p")
3084
3085 self.assertEqual(self.theclass.strptime(dt_str, "%I %p").hour,
3086 hour)
3087
3088 def test_strptime_single_digit(self):
3089 # bpo-34903: Check that single digit dates and times are allowed.

Callers

nothing calls this directly

Calls 6

datetimeClass · 0.90
subTestMethod · 0.45
replaceMethod · 0.45
strftimeMethod · 0.45
assertEqualMethod · 0.45
strptimeMethod · 0.45

Tested by

no test coverage detected