(self)
| 3541 | self.assertEqual(dt, dt_rt) |
| 3542 | |
| 3543 | def test_fromisoformat_timespecs(self): |
| 3544 | datetime_bases = [ |
| 3545 | (2009, 12, 4, 8, 17, 45, 123456), |
| 3546 | (2009, 12, 4, 8, 17, 45, 0)] |
| 3547 | |
| 3548 | tzinfos = [None, timezone.utc, |
| 3549 | timezone(timedelta(hours=-5)), |
| 3550 | timezone(timedelta(hours=2)), |
| 3551 | timezone(timedelta(hours=6, minutes=27))] |
| 3552 | |
| 3553 | timespecs = ['hours', 'minutes', 'seconds', |
| 3554 | 'milliseconds', 'microseconds'] |
| 3555 | |
| 3556 | for ip, ts in enumerate(timespecs): |
| 3557 | for tzi in tzinfos: |
| 3558 | for dt_tuple in datetime_bases: |
| 3559 | if ts == 'milliseconds': |
| 3560 | new_microseconds = 1000 * (dt_tuple[6] // 1000) |
| 3561 | dt_tuple = dt_tuple[0:6] + (new_microseconds,) |
| 3562 | |
| 3563 | dt = self.theclass(*(dt_tuple[0:(4 + ip)]), tzinfo=tzi) |
| 3564 | dtstr = dt.isoformat(timespec=ts) |
| 3565 | with self.subTest(dtstr=dtstr): |
| 3566 | dt_rt = self.theclass.fromisoformat(dtstr) |
| 3567 | self.assertEqual(dt, dt_rt) |
| 3568 | |
| 3569 | def test_fromisoformat_datetime_examples(self): |
| 3570 | UTC = timezone.utc |
nothing calls this directly
no test coverage detected