diff options
author | Collin Winter <collinw@gmail.com> | 2009-04-16 03:18:06 (GMT) |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2009-04-16 03:18:06 (GMT) |
commit | 771d8341cd61c8c2faa1a13f3fad0e08079e49ff (patch) | |
tree | 31dadcdb5c84f2dc4261bd9a7c315aead6dd9885 /Lib/test/test_pickle.py | |
parent | f4ac1494dc0dc9c414cb5ca293afa5ee7044bab3 (diff) | |
download | cpython-771d8341cd61c8c2faa1a13f3fad0e08079e49ff.zip cpython-771d8341cd61c8c2faa1a13f3fad0e08079e49ff.tar.gz cpython-771d8341cd61c8c2faa1a13f3fad0e08079e49ff.tar.bz2 |
Port r71408 to py3k: issue 5665, add more pickling tests.
Diffstat (limited to 'Lib/test/test_pickle.py')
-rw-r--r-- | Lib/test/test_pickle.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py index 65a7adc..bb681bf 100644 --- a/Lib/test/test_pickle.py +++ b/Lib/test/test_pickle.py @@ -6,6 +6,7 @@ from test import support from test.pickletester import AbstractPickleTests from test.pickletester import AbstractPickleModuleTests from test.pickletester import AbstractPersistentPicklerTests +from test.pickletester import AbstractPicklerUnpicklerObjectTests try: import _pickle @@ -60,6 +61,12 @@ class PyPersPicklerTests(AbstractPersistentPicklerTests): return u.load() +class PyPicklerUnpicklerObjectTests(AbstractPicklerUnpicklerObjectTests): + + pickler_class = pickle._Pickler + unpickler_class = pickle._Unpickler + + if has_c_implementation: class CPicklerTests(PyPicklerTests): pickler = _pickle.Pickler @@ -69,11 +76,26 @@ if has_c_implementation: pickler = _pickle.Pickler unpickler = _pickle.Unpickler + class CDumpPickle_LoadPickle(PyPicklerTests): + pickler = _pickle.Pickler + unpickler = pickle._Unpickler + + class DumpPickle_CLoadPickle(PyPicklerTests): + pickler = pickle._Pickler + unpickler = _pickle.Unpickler + + class CPicklerUnpicklerObjectTests(AbstractPicklerUnpicklerObjectTests): + pickler_class = _pickle.Pickler + unpickler_class = _pickle.Unpickler + def test_main(): tests = [PickleTests, PyPicklerTests, PyPersPicklerTests] if has_c_implementation: - tests.extend([CPicklerTests, CPersPicklerTests]) + tests.extend([CPicklerTests, CPersPicklerTests, + CDumpPickle_LoadPickle, DumpPickle_CLoadPickle, + PyPicklerUnpicklerObjectTests, + CPicklerUnpicklerObjectTests]) support.run_unittest(*tests) support.run_doctest(pickle) |