get rid of ast_error_finish by passing the compiling struct to ast_error

This commit is contained in:
Benjamin Peterson 2012-09-02 15:04:51 -04:00
parent e9f72dbf0d
commit bd0df50fb6
2 changed files with 74 additions and 118 deletions

View file

@ -411,7 +411,9 @@ class ASTHelpers_Test(unittest.TestCase):
try:
1/0
except Exception:
self.assertRaises(SyntaxError, ast.parse, r"'\U'")
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")')