Example #1
0
 def test_abstract_ast_types(self):
     ast = self.ast
     ast.expr()
     ast.AST()
     class X(ast.AST):
         pass
     X()
     class Y(ast.expr):
         pass
     Y()
     exc = raises(TypeError, ast.AST, 2)
     assert exc.value.args[0] == "_ast.AST constructor takes 0 positional arguments"
Example #2
0
 def test_abstract_ast_types(self):
     ast = self.ast
     ast.expr()
     ast.AST()
     class X(ast.AST):
         pass
     X()
     class Y(ast.expr):
         pass
     Y()
     exc = raises(TypeError, ast.AST, 2)
     assert exc.value.args[0] == "_ast.AST constructor takes 0 positional arguments"
Example #3
0
 def test_invalid_sum(self):
     import _ast as ast
     pos = dict(lineno=2, col_offset=3)
     m = ast.Module([ast.Expr(ast.expr(**pos), **pos)])
     exc = raises(TypeError, compile, m, "<test>", "exec")
Example #4
0
 def test_invalid_sum(self):
     import _ast as ast
     pos = dict(lineno=2, col_offset=3)
     m = ast.Module([ast.Expr(ast.expr(**pos), **pos)])
     exc = raises(TypeError, compile, m, "<test>", "exec")