(self)
| 3288 | self.assertIn(f"day 32 must be in range 1..30 for month 4 in year 2009", str(msg.exception)) |
| 3289 | |
| 3290 | def test_fromisoformat_datetime(self): |
| 3291 | # Test that isoformat() is reversible |
| 3292 | base_dates = [ |
| 3293 | (1, 1, 1), |
| 3294 | (1900, 1, 1), |
| 3295 | (2004, 11, 12), |
| 3296 | (2017, 5, 30) |
| 3297 | ] |
| 3298 | |
| 3299 | base_times = [ |
| 3300 | (0, 0, 0, 0), |
| 3301 | (0, 0, 0, 241000), |
| 3302 | (0, 0, 0, 234567), |
| 3303 | (12, 30, 45, 234567) |
| 3304 | ] |
| 3305 | |
| 3306 | separators = [' ', 'T'] |
| 3307 | |
| 3308 | tzinfos = [None, timezone.utc, |
| 3309 | timezone(timedelta(hours=-5)), |
| 3310 | timezone(timedelta(hours=2))] |
| 3311 | |
| 3312 | dts = [self.theclass(*date_tuple, *time_tuple, tzinfo=tzi) |
| 3313 | for date_tuple in base_dates |
| 3314 | for time_tuple in base_times |
| 3315 | for tzi in tzinfos] |
| 3316 | |
| 3317 | for dt in dts: |
| 3318 | for sep in separators: |
| 3319 | dtstr = dt.isoformat(sep=sep) |
| 3320 | |
| 3321 | with self.subTest(dtstr=dtstr): |
| 3322 | dt_rt = self.theclass.fromisoformat(dtstr) |
| 3323 | self.assertEqual(dt, dt_rt) |
| 3324 | |
| 3325 | def test_fromisoformat_timezone(self): |
| 3326 | base_dt = self.theclass(2014, 12, 30, 12, 30, 45, 217456) |
nothing calls this directly
no test coverage detected