(self)
| 317 | self.assertEqual(dt.dst(), offset.dst, dt) |
| 318 | |
| 319 | def test_folds_and_gaps(self): |
| 320 | test_cases = [] |
| 321 | for key in self.zones(): |
| 322 | tests = {"folds": [], "gaps": []} |
| 323 | for zt in self.load_transition_examples(key): |
| 324 | if zt.fold: |
| 325 | test_group = tests["folds"] |
| 326 | elif zt.gap: |
| 327 | test_group = tests["gaps"] |
| 328 | else: |
| 329 | # Assign a random variable here to disable the peephole |
| 330 | # optimizer so that coverage can see this line. |
| 331 | # See bpo-2506 for more information. |
| 332 | no_peephole_opt = None |
| 333 | continue |
| 334 | |
| 335 | # Cases are of the form key, dt, fold, offset |
| 336 | dt = zt.anomaly_start - timedelta(seconds=1) |
| 337 | test_group.append((dt, 0, zt.offset_before)) |
| 338 | test_group.append((dt, 1, zt.offset_before)) |
| 339 | |
| 340 | dt = zt.anomaly_start |
| 341 | test_group.append((dt, 0, zt.offset_before)) |
| 342 | test_group.append((dt, 1, zt.offset_after)) |
| 343 | |
| 344 | dt = zt.anomaly_start + timedelta(seconds=1) |
| 345 | test_group.append((dt, 0, zt.offset_before)) |
| 346 | test_group.append((dt, 1, zt.offset_after)) |
| 347 | |
| 348 | dt = zt.anomaly_end - timedelta(seconds=1) |
| 349 | test_group.append((dt, 0, zt.offset_before)) |
| 350 | test_group.append((dt, 1, zt.offset_after)) |
| 351 | |
| 352 | dt = zt.anomaly_end |
| 353 | test_group.append((dt, 0, zt.offset_after)) |
| 354 | test_group.append((dt, 1, zt.offset_after)) |
| 355 | |
| 356 | dt = zt.anomaly_end + timedelta(seconds=1) |
| 357 | test_group.append((dt, 0, zt.offset_after)) |
| 358 | test_group.append((dt, 1, zt.offset_after)) |
| 359 | |
| 360 | for grp, test_group in tests.items(): |
| 361 | test_cases.append(((key, grp), test_group)) |
| 362 | |
| 363 | for (key, grp), tests in test_cases: |
| 364 | with self.subTest(key=key, grp=grp): |
| 365 | tzi = self.zone_from_key(key) |
| 366 | |
| 367 | for dt, fold, offset in tests: |
| 368 | dt = dt.replace(fold=fold, tzinfo=tzi) |
| 369 | |
| 370 | self.assertEqual(dt.tzname(), offset.tzname, dt) |
| 371 | self.assertEqual(dt.utcoffset(), offset.utcoffset, dt) |
| 372 | self.assertEqual(dt.dst(), offset.dst, dt) |
| 373 | |
| 374 | def test_folds_from_utc(self): |
| 375 | for key in self.zones(): |
nothing calls this directly
no test coverage detected