diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-04-03 21:11:27 (GMT) |
---|---|---|
committer | Ćukasz Langa <lukasz@langa.pl> | 2018-04-03 21:11:27 (GMT) |
commit | c869529ea9fbed574d34cf7ac139ca3f81b62ef0 (patch) | |
tree | af8fd4779929fc236376848b43698784b8e90115 /Lib | |
parent | 629338f1404ea9cd75e4fb0389a2fbe1b589de43 (diff) | |
download | cpython-c869529ea9fbed574d34cf7ac139ca3f81b62ef0.zip cpython-c869529ea9fbed574d34cf7ac139ca3f81b62ef0.tar.gz cpython-c869529ea9fbed574d34cf7ac139ca3f81b62ef0.tar.bz2 |
bpo-33209: End framing at the end of C implementation of pickle.Pickler.dump(). (GH-6363)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/pickletester.py | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py index b84b878..71c2fea 100644 --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -2781,29 +2781,30 @@ class AbstractPicklerUnpicklerObjectTests(unittest.TestCase): # object again, the third serialized form should be identical to the # first one we obtained. data = ["abcdefg", "abcdefg", 44] - f = io.BytesIO() - pickler = self.pickler_class(f) + for proto in protocols: + f = io.BytesIO() + pickler = self.pickler_class(f, proto) - pickler.dump(data) - first_pickled = f.getvalue() + pickler.dump(data) + first_pickled = f.getvalue() - # Reset BytesIO object. - f.seek(0) - f.truncate() + # Reset BytesIO object. + f.seek(0) + f.truncate() - pickler.dump(data) - second_pickled = f.getvalue() + pickler.dump(data) + second_pickled = f.getvalue() - # Reset the Pickler and BytesIO objects. - pickler.clear_memo() - f.seek(0) - f.truncate() + # Reset the Pickler and BytesIO objects. + pickler.clear_memo() + f.seek(0) + f.truncate() - pickler.dump(data) - third_pickled = f.getvalue() + pickler.dump(data) + third_pickled = f.getvalue() - self.assertNotEqual(first_pickled, second_pickled) - self.assertEqual(first_pickled, third_pickled) + self.assertNotEqual(first_pickled, second_pickled) + self.assertEqual(first_pickled, third_pickled) def test_priming_pickler_memo(self): # Verify that we can set the Pickler's memo attribute. |