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

Method test_isocalendar_pickling

Lib/test/datetimetester.py:1533–1542  ·  view source on GitHub ↗

Test that the result of datetime.isocalendar() can be pickled. The result of a round trip should be a plain tuple.

(self)

Source from the content-addressed store, hash-verified

1531 self.assertEqual((t.year, t.week, t.weekday), exp_iso)
1532
1533 def test_isocalendar_pickling(self):
1534 """Test that the result of datetime.isocalendar() can be pickled.
1535
1536 The result of a round trip should be a plain tuple.
1537 """
1538 d = self.theclass(2019, 1, 1)
1539 p = pickle.dumps(d.isocalendar())
1540 res = pickle.loads(p)
1541 self.assertEqual(type(res), tuple)
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

Callers

nothing calls this directly

Calls 4

isocalendarMethod · 0.80
dumpsMethod · 0.45
loadsMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected