diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2017-11-15 04:32:04 -0800 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-11-15 14:32:04 +0200 |
commit | eb38367f20b05f2ad04a4833bceb369b5e78b1a3 (patch) | |
tree | f3fb87aa5b68db1b3cf97805adbc883a4a01bd06 /Lib/test/test_pickle.py | |
parent | 42336def77f53861284336b3335098a1b9b8cab2 (diff) | |
download | cpython-git-eb38367f20b05f2ad04a4833bceb369b5e78b1a3.tar.gz |
bpo-32032: Test both implementations of module-level pickle API. (GH-4401) (#4403)
(cherry picked from commit 6545256df93ba54f811206107274cfa5a6d76b86)
Diffstat (limited to 'Lib/test/test_pickle.py')
-rw-r--r-- | Lib/test/test_pickle.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py index e6c5d08522..ee71c63273 100644 --- a/Lib/test/test_pickle.py +++ b/Lib/test/test_pickle.py @@ -26,8 +26,13 @@ except ImportError: has_c_implementation = False -class PickleTests(AbstractPickleModuleTests): - pass +class PyPickleTests(AbstractPickleModuleTests): + dump = staticmethod(pickle._dump) + dumps = staticmethod(pickle._dumps) + load = staticmethod(pickle._load) + loads = staticmethod(pickle._loads) + Pickler = pickle._Pickler + Unpickler = pickle._Unpickler class PyUnpicklerTests(AbstractUnpickleTests): @@ -136,6 +141,9 @@ class PyChainDispatchTableTests(AbstractDispatchTableTests): if has_c_implementation: + class CPickleTests(AbstractPickleModuleTests): + from _pickle import dump, dumps, load, loads, Pickler, Unpickler + class CUnpicklerTests(PyUnpicklerTests): unpickler = _pickle.Unpickler bad_stack_errors = (pickle.UnpicklingError,) @@ -426,12 +434,12 @@ class CompatPickleTests(unittest.TestCase): def test_main(): - tests = [PickleTests, PyUnpicklerTests, PyPicklerTests, + tests = [PyPickleTests, PyUnpicklerTests, PyPicklerTests, PyPersPicklerTests, PyIdPersPicklerTests, PyDispatchTableTests, PyChainDispatchTableTests, CompatPickleTests] if has_c_implementation: - tests.extend([CUnpicklerTests, CPicklerTests, + tests.extend([CPickleTests, CUnpicklerTests, CPicklerTests, CPersPicklerTests, CIdPersPicklerTests, CDumpPickle_LoadPickle, DumpPickle_CLoadPickle, PyPicklerUnpicklerObjectTests, |