summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_datetime.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-12-15 12:02:43 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-12-15 12:02:43 (GMT)
commit655720e2758a15c85effb340ff65f4b93e7cc7a7 (patch)
treed582731bc3e14a86222093e806d2ec88b2640f8f /Lib/test/test_datetime.py
parentc3741a067b3443cdac7739b21e0cd1bacf155b02 (diff)
downloadcpython-655720e2758a15c85effb340ff65f4b93e7cc7a7.zip
cpython-655720e2758a15c85effb340ff65f4b93e7cc7a7.tar.gz
cpython-655720e2758a15c85effb340ff65f4b93e7cc7a7.tar.bz2
Issue #22777: Test pickling with all protocols.
Diffstat (limited to 'Lib/test/test_datetime.py')
-rw-r--r--Lib/test/test_datetime.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py
index 7caa408..19ffbcd 100644
--- a/Lib/test/test_datetime.py
+++ b/Lib/test/test_datetime.py
@@ -1421,11 +1421,12 @@ class TestDateTime(TestDate):
def test_more_pickling(self):
a = self.theclass(2003, 2, 7, 16, 48, 37, 444116)
- s = pickle.dumps(a)
- b = pickle.loads(s)
- self.assertEqual(b.year, 2003)
- self.assertEqual(b.month, 2)
- self.assertEqual(b.day, 7)
+ for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+ s = pickle.dumps(a, proto)
+ b = pickle.loads(s)
+ self.assertEqual(b.year, 2003)
+ self.assertEqual(b.month, 2)
+ self.assertEqual(b.day, 7)
def test_pickling_subclass_datetime(self):
args = 6, 7, 23, 20, 59, 1, 64**2