(self)
| 1179 | self.assertIs(type(got), date) |
| 1180 | |
| 1181 | def test_strptime_single_digit(self): |
| 1182 | # bpo-34903: Check that single digit dates are allowed. |
| 1183 | strptime = date.strptime |
| 1184 | with self.assertRaises(ValueError): |
| 1185 | # %y does require two digits. |
| 1186 | newdate = strptime('01/02/3', '%d/%m/%y') |
| 1187 | |
| 1188 | d1 = date(2003, 2, 1) |
| 1189 | d2 = date(2003, 1, 2) |
| 1190 | d3 = date(2003, 1, 25) |
| 1191 | inputs = [ |
| 1192 | ('%d', '1/02/03', '%d/%m/%y', d1), |
| 1193 | ('%m', '01/2/03', '%d/%m/%y', d1), |
| 1194 | ('%j', '2/03', '%j/%y', d2), |
| 1195 | ('%w', '6/04/03', '%w/%U/%y', d1), |
| 1196 | # %u requires a single digit. |
| 1197 | ('%W', '6/4/2003', '%u/%W/%Y', d1), |
| 1198 | ('%V', '6/4/2003', '%u/%V/%G', d3), |
| 1199 | ] |
| 1200 | for reason, string, format, target in inputs: |
| 1201 | reason = 'test single digit ' + reason |
| 1202 | with self.subTest(reason=reason, |
| 1203 | string=string, |
| 1204 | format=format, |
| 1205 | target=target): |
| 1206 | newdate = strptime(string, format) |
| 1207 | self.assertEqual(newdate, target, msg=reason) |
| 1208 | |
| 1209 | @warnings_helper.ignore_warnings(category=DeprecationWarning) |
| 1210 | def test_strptime_leap_year(self): |
nothing calls this directly
no test coverage detected