diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-09-29 12:33:24 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-09-29 12:33:24 (GMT) |
commit | c6b54b45eab14b24d5ff21393ce74c80459d80ef (patch) | |
tree | daa1a0dac5bfb0f30b58913c2892faf2f3d50c7f /Lib/test/test_pickle.py | |
parent | 37f81355b0bd1b7f7b23a7efdf3267d691160669 (diff) | |
download | cpython-c6b54b45eab14b24d5ff21393ce74c80459d80ef.zip cpython-c6b54b45eab14b24d5ff21393ce74c80459d80ef.tar.gz cpython-c6b54b45eab14b24d5ff21393ce74c80459d80ef.tar.bz2 |
Moved unpickling tests with prepickled data to separate class.
Diffstat (limited to 'Lib/test/test_pickle.py')
-rw-r--r-- | Lib/test/test_pickle.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py index f5add27..3d75d65 100644 --- a/Lib/test/test_pickle.py +++ b/Lib/test/test_pickle.py @@ -10,6 +10,7 @@ import sys import unittest from test import support +from test.pickletester import AbstractUnpickleTests from test.pickletester import AbstractPickleTests from test.pickletester import AbstractPickleModuleTests from test.pickletester import AbstractPersistentPicklerTests @@ -28,6 +29,16 @@ class PickleTests(AbstractPickleModuleTests): pass +class PyUnpicklerTests(AbstractUnpickleTests): + + unpickler = pickle._Unpickler + + def loads(self, buf, **kwds): + f = io.BytesIO(buf) + u = self.unpickler(f, **kwds) + return u.load() + + class PyPicklerTests(AbstractPickleTests): pickler = pickle._Pickler @@ -46,7 +57,8 @@ class PyPicklerTests(AbstractPickleTests): return u.load() -class InMemoryPickleTests(AbstractPickleTests, BigmemPickleTests): +class InMemoryPickleTests(AbstractPickleTests, AbstractUnpickleTests, + BigmemPickleTests): pickler = pickle._Pickler unpickler = pickle._Unpickler @@ -105,6 +117,9 @@ class PyChainDispatchTableTests(AbstractDispatchTableTests): if has_c_implementation: + class CUnpicklerTests(PyUnpicklerTests): + unpickler = _pickle.Unpickler + class CPicklerTests(PyPicklerTests): pickler = _pickle.Pickler unpickler = _pickle.Unpickler @@ -372,11 +387,11 @@ class CompatPickleTests(unittest.TestCase): def test_main(): - tests = [PickleTests, PyPicklerTests, PyPersPicklerTests, + tests = [PickleTests, PyUnpicklerTests, PyPicklerTests, PyPersPicklerTests, PyDispatchTableTests, PyChainDispatchTableTests, CompatPickleTests] if has_c_implementation: - tests.extend([CPicklerTests, CPersPicklerTests, + tests.extend([CUnpicklerTests, CPicklerTests, CPersPicklerTests, CDumpPickle_LoadPickle, DumpPickle_CLoadPickle, PyPicklerUnpicklerObjectTests, CPicklerUnpicklerObjectTests, |