MCPcopy Index your code
hub / github.com/python/cpython / test_iso_long_years

Method test_iso_long_years

Lib/test/datetimetester.py:1544–1580  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1542 self.assertEqual(res, (2019, 1, 2))
1543
1544 def test_iso_long_years(self):
1545 # Calculate long ISO years and compare to table from
1546 # http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm
1547 ISO_LONG_YEARS_TABLE = """
1548 4 32 60 88
1549 9 37 65 93
1550 15 43 71 99
1551 20 48 76
1552 26 54 82
1553
1554 105 133 161 189
1555 111 139 167 195
1556 116 144 172
1557 122 150 178
1558 128 156 184
1559
1560 201 229 257 285
1561 207 235 263 291
1562 212 240 268 296
1563 218 246 274
1564 224 252 280
1565
1566 303 331 359 387
1567 308 336 364 392
1568 314 342 370 398
1569 320 348 376
1570 325 353 381
1571 """
1572 iso_long_years = sorted(map(int, ISO_LONG_YEARS_TABLE.split()))
1573 L = []
1574 for i in range(400):
1575 d = self.theclass(2000+i, 12, 31)
1576 d1 = self.theclass(1600+i, 12, 31)
1577 self.assertEqual(d.isocalendar()[1:], d1.isocalendar()[1:])
1578 if d.isocalendar()[1] == 53:
1579 L.append(i)
1580 self.assertEqual(L, iso_long_years)
1581
1582 def test_isoformat(self):
1583 t = self.theclass(2, 3, 2)

Callers

nothing calls this directly

Calls 4

isocalendarMethod · 0.80
splitMethod · 0.45
assertEqualMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected