Commit c6b54b45 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Moved unpickling tests with prepickled data to separate class.

parent 37f81355
This diff is collapsed.
...@@ -10,6 +10,7 @@ import sys ...@@ -10,6 +10,7 @@ import sys
import unittest import unittest
from test import support from test import support
from test.pickletester import AbstractUnpickleTests
from test.pickletester import AbstractPickleTests from test.pickletester import AbstractPickleTests
from test.pickletester import AbstractPickleModuleTests from test.pickletester import AbstractPickleModuleTests
from test.pickletester import AbstractPersistentPicklerTests from test.pickletester import AbstractPersistentPicklerTests
...@@ -28,6 +29,16 @@ class PickleTests(AbstractPickleModuleTests): ...@@ -28,6 +29,16 @@ class PickleTests(AbstractPickleModuleTests):
pass 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): class PyPicklerTests(AbstractPickleTests):
pickler = pickle._Pickler pickler = pickle._Pickler
...@@ -46,7 +57,8 @@ class PyPicklerTests(AbstractPickleTests): ...@@ -46,7 +57,8 @@ class PyPicklerTests(AbstractPickleTests):
return u.load() return u.load()
class InMemoryPickleTests(AbstractPickleTests, BigmemPickleTests): class InMemoryPickleTests(AbstractPickleTests, AbstractUnpickleTests,
BigmemPickleTests):
pickler = pickle._Pickler pickler = pickle._Pickler
unpickler = pickle._Unpickler unpickler = pickle._Unpickler
...@@ -105,6 +117,9 @@ class PyChainDispatchTableTests(AbstractDispatchTableTests): ...@@ -105,6 +117,9 @@ class PyChainDispatchTableTests(AbstractDispatchTableTests):
if has_c_implementation: if has_c_implementation:
class CUnpicklerTests(PyUnpicklerTests):
unpickler = _pickle.Unpickler
class CPicklerTests(PyPicklerTests): class CPicklerTests(PyPicklerTests):
pickler = _pickle.Pickler pickler = _pickle.Pickler
unpickler = _pickle.Unpickler unpickler = _pickle.Unpickler
...@@ -372,11 +387,11 @@ class CompatPickleTests(unittest.TestCase): ...@@ -372,11 +387,11 @@ class CompatPickleTests(unittest.TestCase):
def test_main(): def test_main():
tests = [PickleTests, PyPicklerTests, PyPersPicklerTests, tests = [PickleTests, PyUnpicklerTests, PyPicklerTests, PyPersPicklerTests,
PyDispatchTableTests, PyChainDispatchTableTests, PyDispatchTableTests, PyChainDispatchTableTests,
CompatPickleTests] CompatPickleTests]
if has_c_implementation: if has_c_implementation:
tests.extend([CPicklerTests, CPersPicklerTests, tests.extend([CUnpicklerTests, CPicklerTests, CPersPicklerTests,
CDumpPickle_LoadPickle, DumpPickle_CLoadPickle, CDumpPickle_LoadPickle, DumpPickle_CLoadPickle,
PyPicklerUnpicklerObjectTests, PyPicklerUnpicklerObjectTests,
CPicklerUnpicklerObjectTests, CPicklerUnpicklerObjectTests,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment