mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue 5665: add more pickling tests.
- Add tests for the module-level load() and dump() functions. - Add tests for cPickle's internal data structures, stressing workloads with many gets/puts. - Add tests for the Pickler and Unpickler classes, in particular the memo attribute. - test_xpickle is extended to test backwards compatibility with Python 2.4, 2.5 and 2.6 by round-tripping pickled objects through a worker process. This is guarded with a regrtest -u xpickle resource.
This commit is contained in:
parent
5963185b23
commit
f8089c7789
5 changed files with 428 additions and 21 deletions
|
@ -1,6 +1,7 @@
|
|||
import cPickle, unittest
|
||||
from cStringIO import StringIO
|
||||
from test.pickletester import AbstractPickleTests, AbstractPickleModuleTests
|
||||
from test.pickletester import AbstractPicklerUnpicklerObjectTests
|
||||
from test import test_support
|
||||
|
||||
class cPickleTests(AbstractPickleTests, AbstractPickleModuleTests):
|
||||
|
@ -90,6 +91,12 @@ class cPickleFastPicklerTests(AbstractPickleTests):
|
|||
b = self.loads(self.dumps(a))
|
||||
self.assertEqual(a, b)
|
||||
|
||||
class cPicklePicklerUnpicklerObjectTests(AbstractPicklerUnpicklerObjectTests):
|
||||
|
||||
pickler_class = cPickle.Pickler
|
||||
unpickler_class = cPickle.Unpickler
|
||||
|
||||
|
||||
class Node(object):
|
||||
pass
|
||||
|
||||
|
@ -120,6 +127,7 @@ def test_main():
|
|||
cPickleListPicklerTests,
|
||||
cPickleFastPicklerTests,
|
||||
cPickleDeepRecursive,
|
||||
cPicklePicklerUnpicklerObjectTests,
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue