mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-32032: Test both implementations of module-level pickle API. (#4401)
This commit is contained in:
parent
2ae4ad7ca4
commit
6545256df9
3 changed files with 25 additions and 18 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue