diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-12-15 12:03:42 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-12-15 12:03:42 (GMT) |
commit | bad1257c96943dcb39584a41e1a178542479df97 (patch) | |
tree | dbb4594291c7df3660da701eb062bec35446bcba /Lib/test/test_email | |
parent | 79b81738ef052e9406adb8e98f0d292928053c01 (diff) | |
download | cpython-bad1257c96943dcb39584a41e1a178542479df97.zip cpython-bad1257c96943dcb39584a41e1a178542479df97.tar.gz cpython-bad1257c96943dcb39584a41e1a178542479df97.tar.bz2 |
Issue #22777: Test pickling with all protocols.
Diffstat (limited to 'Lib/test/test_email')
-rw-r--r-- | Lib/test/test_email/test_pickleable.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Lib/test/test_email/test_pickleable.py b/Lib/test/test_email/test_pickleable.py index daa8d25..16b4467 100644 --- a/Lib/test/test_email/test_pickleable.py +++ b/Lib/test/test_email/test_pickleable.py @@ -30,9 +30,10 @@ class TestPickleCopyHeader(TestEmailBase): def header_as_pickle(self, name, value): header = self.header_factory(name, value) - p = pickle.dumps(header) - h = pickle.loads(p) - self.assertEqual(str(h), str(header)) + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + p = pickle.dumps(header, proto) + h = pickle.loads(p) + self.assertEqual(str(h), str(header)) @parameterize @@ -65,9 +66,10 @@ class TestPickleCopyMessage(TestEmailBase): self.assertEqual(msg2.as_string(), msg.as_string()) def msg_as_pickle(self, msg): - p = pickle.dumps(msg) - msg2 = pickle.loads(p) - self.assertEqual(msg2.as_string(), msg.as_string()) + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + p = pickle.dumps(msg, proto) + msg2 = pickle.loads(p) + self.assertEqual(msg2.as_string(), msg.as_string()) if __name__ == '__main__': |