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

Method test_strptime_single_digit

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

Source from the content-addressed store, hash-verified

4068 self.theclass.strptime(tzstr, "%z")
4069
4070 def test_strptime_single_digit(self):
4071 # bpo-34903: Check that single digit times are allowed.
4072 t = self.theclass(4, 5, 6)
4073 inputs = [
4074 ('%H', '4:05:06', '%H:%M:%S', t),
4075 ('%M', '04:5:06', '%H:%M:%S', t),
4076 ('%S', '04:05:6', '%H:%M:%S', t),
4077 ('%I', '4am:05:06', '%I%p:%M:%S', t),
4078 ]
4079 for reason, string, format, target in inputs:
4080 reason = 'test single digit ' + reason
4081 with self.subTest(reason=reason,
4082 string=string,
4083 format=format,
4084 target=target):
4085 newdate = self.theclass.strptime(string, format)
4086 self.assertEqual(newdate, target, msg=reason)
4087
4088 def test_bool(self):
4089 # time is always True.

Callers

nothing calls this directly

Calls 3

subTestMethod · 0.80
strptimeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected