My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes  
Changes to /branches/release-2009Q1-maint/Lib/test/test_pickletools.py
r250 vs. r720 Compare: vs.  Format:
Revision r720
Go to: 
Project members, sign in to write a code review
/branches/release-2009Q1-maint/Lib/test/test_pickletools.py   r250 /branches/release-2009Q1-maint/Lib/test/test_pickletools.py   r720
1 import pickle 1 import pickle
2 import pickletools 2 import pickletools
3 from test import test_support 3 from test import test_support
4 from test.pickletester import AbstractPickleTests 4 from test.pickletester import AbstractPickleTests
5 from test.pickletester import AbstractPickleModuleTests 5 from test.pickletester import AbstractPickleModuleTests
6 6
7 class OptimizedPickleTests(AbstractPickleTests, AbstractPickleModuleTests): 7 class OptimizedPickleTests(AbstractPickleTests, AbstractPickleModuleTests):
8 8
9 def dumps(self, arg, proto=0, fast=0): 9 def dumps(self, arg, proto=0, fast=False):
10 return pickletools.optimize(pickle.dumps(arg, proto)) 10 return pickletools.optimize(pickle.dumps(arg, proto))
11 11
12 def loads(self, buf): 12 def loads(self, buf):
13 return pickle.loads(buf) 13 return pickle.loads(buf)
14 14
15 def dump(self, arg, buf, proto=0, fast=False):
16 data = self.dumps(arg, proto, fast)
17 buf.write(data)
18
19 def load(self, buf):
20 return pickle.load(buf)
21
15 module = pickle 22 module = pickle
16 error = KeyError 23 error = KeyError
17 24
18 def test_main(): 25 def test_main():
19 test_support.run_unittest(OptimizedPickleTests) 26 test_support.run_unittest(OptimizedPickleTests)
20 test_support.run_doctest(pickletools) 27 test_support.run_doctest(pickletools)
21 28
22 29
23 if __name__ == "__main__": 30 if __name__ == "__main__":
24 test_main() 31 test_main()
Powered by Google Project Hosting