2 from cStringIO
import StringIO
4 from test
import test_support
6 from test
.pickletester
import AbstractPickleTests
7 from test
.pickletester
import AbstractPickleModuleTests
8 from test
.pickletester
import AbstractPersistentPicklerTests
9 from test
.pickletester
import AbstractPicklerUnpicklerObjectTests
11 class PickleTests(AbstractPickleTests
, AbstractPickleModuleTests
):
13 def dumps(self
, arg
, proto
=0, fast
=0):
15 return pickle
.dumps(arg
, proto
)
19 return pickle
.loads(buf
)
24 class PicklerTests(AbstractPickleTests
):
28 def dumps(self
, arg
, proto
=0, fast
=0):
30 p
= pickle
.Pickler(f
, proto
)
39 u
= pickle
.Unpickler(f
)
42 class PersPicklerTests(AbstractPersistentPicklerTests
):
44 def dumps(self
, arg
, proto
=0, fast
=0):
45 class PersPickler(pickle
.Pickler
):
46 def persistent_id(subself
, obj
):
47 return self
.persistent_id(obj
)
49 p
= PersPickler(f
, proto
)
57 class PersUnpickler(pickle
.Unpickler
):
58 def persistent_load(subself
, obj
):
59 return self
.persistent_load(obj
)
64 class PicklerUnpicklerObjectTests(AbstractPicklerUnpicklerObjectTests
):
66 pickler_class
= pickle
.Pickler
67 unpickler_class
= pickle
.Unpickler
71 test_support
.run_unittest(
75 PicklerUnpicklerObjectTests
,
77 test_support
.run_doctest(pickle
)
79 if __name__
== "__main__":