mirror of
https://github.com/python/cpython.git
synced 2025-11-25 12:44:13 +00:00
Add tests for pickletools.optimize().
This commit is contained in:
parent
6bf51da9d4
commit
21290eacf6
1 changed files with 22 additions and 1 deletions
|
|
@ -1,3 +1,24 @@
|
|||
import pickle
|
||||
import pickletools
|
||||
from test import test_support
|
||||
test_support.run_doctest(pickletools)
|
||||
from test.pickletester import AbstractPickleTests
|
||||
from test.pickletester import AbstractPickleModuleTests
|
||||
|
||||
class OptimizedPickleTests(AbstractPickleTests, AbstractPickleModuleTests):
|
||||
|
||||
def dumps(self, arg, proto=0, fast=0):
|
||||
return pickletools.optimize(pickle.dumps(arg, proto))
|
||||
|
||||
def loads(self, buf):
|
||||
return pickle.loads(buf)
|
||||
|
||||
module = pickle
|
||||
error = KeyError
|
||||
|
||||
def test_main():
|
||||
test_support.run_unittest(OptimizedPickleTests)
|
||||
test_support.run_doctest(pickletools)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue