MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_iso_long_years

Method test_iso_long_years

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

sortedFunction · 0.85
isocalendarMethod · 0.80
splitMethod · 0.45
assertEqualMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected