This commit is contained in:
Benjamin Peterson 2012-09-02 14:24:44 -04:00
commit c7f447c89f
3 changed files with 17 additions and 0 deletions

View file

@ -407,6 +407,12 @@ 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:
self.assertRaises(SyntaxError, ast.parse, r"'\U'")
def test_dump(self):
node = ast.parse('spam(eggs, "and cheese")')
self.assertEqual(ast.dump(node),