(self)
| 3453 | self.assertIn(f"day 32 must be in range 1..30 for month 4 in year 2009", str(msg.exception)) |
| 3454 | |
| 3455 | def test_fromisoformat_datetime(self): |
| 3456 | # Test that isoformat() is reversible |
| 3457 | base_dates = [ |
| 3458 | (1, 1, 1), |
| 3459 | (1900, 1, 1), |
| 3460 | (2004, 11, 12), |
| 3461 | (2017, 5, 30) |
| 3462 | ] |
| 3463 | |
| 3464 | base_times = [ |
| 3465 | (0, 0, 0, 0), |
| 3466 | (0, 0, 0, 241000), |
| 3467 | (0, 0, 0, 234567), |
| 3468 | (12, 30, 45, 234567) |
| 3469 | ] |
| 3470 | |
| 3471 | separators = [' ', 'T'] |
| 3472 | |
| 3473 | tzinfos = [None, timezone.utc, |
| 3474 | timezone(timedelta(hours=-5)), |
| 3475 | timezone(timedelta(hours=2))] |
| 3476 | |
| 3477 | dts = [self.theclass(*date_tuple, *time_tuple, tzinfo=tzi) |
| 3478 | for date_tuple in base_dates |
| 3479 | for time_tuple in base_times |
| 3480 | for tzi in tzinfos] |
| 3481 | |
| 3482 | for dt in dts: |
| 3483 | for sep in separators: |
| 3484 | dtstr = dt.isoformat(sep=sep) |
| 3485 | |
| 3486 | with self.subTest(dtstr=dtstr): |
| 3487 | dt_rt = self.theclass.fromisoformat(dtstr) |
| 3488 | self.assertEqual(dt, dt_rt) |
| 3489 | |
| 3490 | def test_fromisoformat_timezone(self): |
| 3491 | base_dt = self.theclass(2014, 12, 30, 12, 30, 45, 217456) |
nothing calls this directly
no test coverage detected