Home | History | Annotate | Download | only in test
      1 import pickle
      2 import pickletools
      3 from test import test_support
      4 from test.pickletester import AbstractPickleTests
      5 from test.pickletester import AbstractPickleModuleTests
      6 
      7 class OptimizedPickleTests(AbstractPickleTests, AbstractPickleModuleTests):
      8 
      9     def dumps(self, arg, proto=0, fast=0):
     10         return pickletools.optimize(pickle.dumps(arg, proto))
     11 
     12     def loads(self, buf):
     13         return pickle.loads(buf)
     14 
     15     module = pickle
     16     error = KeyError
     17 
     18 def test_main():
     19     test_support.run_unittest(OptimizedPickleTests)
     20     test_support.run_doctest(pickletools)
     21 
     22 
     23 if __name__ == "__main__":
     24     test_main()
     25