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
10 class PickleTests(AbstractPickleTests
, AbstractPickleModuleTests
):
12 def dumps(self
, arg
, proto
=0, fast
=0):
14 return pickle
.dumps(arg
, proto
)
18 return pickle
.loads(buf
)
23 class PicklerTests(AbstractPickleTests
):
27 def dumps(self
, arg
, proto
=0, fast
=0):
29 p
= pickle
.Pickler(f
, proto
)
38 u
= pickle
.Unpickler(f
)
41 class PersPicklerTests(AbstractPersistentPicklerTests
):
43 def dumps(self
, arg
, proto
=0, fast
=0):
44 class PersPickler(pickle
.Pickler
):
45 def persistent_id(subself
, obj
):
46 return self
.persistent_id(obj
)
48 p
= PersPickler(f
, proto
)
56 class PersUnpickler(pickle
.Unpickler
):
57 def persistent_load(subself
, obj
):
58 return self
.persistent_load(obj
)
64 test_support
.run_unittest(
69 test_support
.run_doctest(pickle
)
71 if __name__
== "__main__":