diff options
Diffstat (limited to 'Lib/test/test_ast.py')
-rw-r--r-- | Lib/test/test_ast.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index e068b0a..9d2bd66 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -166,6 +166,20 @@ class AST_Tests(unittest.TestCase): # this used to fail because Sub._fields was None x = _ast.Sub() + def test_pickling(self): + import pickle + mods = [pickle] + try: + import cPickle + mods.append(cPickle) + except ImportError: + pass + protocols = [0, 1, 2] + for mod in mods: + for protocol in protocols: + for ast in (compile(i, "?", "exec", 0x400) for i in exec_tests): + ast2 = mod.loads(mod.dumps(ast, protocol)) + self.assertEquals(to_tuple(ast2), to_tuple(ast)) def test_main(): test_support.run_unittest(AST_Tests) |