summaryrefslogtreecommitdiff
path: root/Lib/test/test_ast.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_ast.py')
-rw-r--r--Lib/test/test_ast.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
index aa08166324..a8853c7e21 100644
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -407,6 +407,14 @@ class ASTHelpers_Test(unittest.TestCase):
b = compile('foo(1 + 1)', '<unknown>', 'exec', ast.PyCF_ONLY_AST)
self.assertEqual(ast.dump(a), ast.dump(b))
+ def test_parse_in_error(self):
+ try:
+ 1/0
+ except Exception:
+ with self.assertRaises(SyntaxError) as e:
+ ast.literal_eval(r"'\U'")
+ self.assertIsNotNone(e.exception.__context__)
+
def test_dump(self):
node = ast.parse('spam(eggs, "and cheese")')
self.assertEqual(ast.dump(node),