(self)
| 3376 | self.assertEqual(dt, dt_rt) |
| 3377 | |
| 3378 | def test_fromisoformat_timespecs(self): |
| 3379 | datetime_bases = [ |
| 3380 | (2009, 12, 4, 8, 17, 45, 123456), |
| 3381 | (2009, 12, 4, 8, 17, 45, 0)] |
| 3382 | |
| 3383 | tzinfos = [None, timezone.utc, |
| 3384 | timezone(timedelta(hours=-5)), |
| 3385 | timezone(timedelta(hours=2)), |
| 3386 | timezone(timedelta(hours=6, minutes=27))] |
| 3387 | |
| 3388 | timespecs = ['hours', 'minutes', 'seconds', |
| 3389 | 'milliseconds', 'microseconds'] |
| 3390 | |
| 3391 | for ip, ts in enumerate(timespecs): |
| 3392 | for tzi in tzinfos: |
| 3393 | for dt_tuple in datetime_bases: |
| 3394 | if ts == 'milliseconds': |
| 3395 | new_microseconds = 1000 * (dt_tuple[6] // 1000) |
| 3396 | dt_tuple = dt_tuple[0:6] + (new_microseconds,) |
| 3397 | |
| 3398 | dt = self.theclass(*(dt_tuple[0:(4 + ip)]), tzinfo=tzi) |
| 3399 | dtstr = dt.isoformat(timespec=ts) |
| 3400 | with self.subTest(dtstr=dtstr): |
| 3401 | dt_rt = self.theclass.fromisoformat(dtstr) |
| 3402 | self.assertEqual(dt, dt_rt) |
| 3403 | |
| 3404 | def test_fromisoformat_datetime_examples(self): |
| 3405 | UTC = timezone.utc |
nothing calls this directly
no test coverage detected