def test_call_macro_ast_eval_statement(): def f(x: ("ast", "eval")): return x try: call_macro(f, ["x = 5"], {}, None) assert False except SyntaxError: # It doesn't make sense to pass a statement to # something that expects to be evaled assert True else: assert False
def test_call_macro_ast_eval_statement(): def f(x: ("ast", "eval")): return x try: rtn = call_macro(f, ["x = 5"], {}, None) assert False except SyntaxError: # It doesn't make sense to pass a statement to # something that expects to be evaled assert True else: assert False
def test_call_macro_raw_kwarg(arg): def f(x: str): return x rtn = call_macro(f, ['*', 'x=' + arg], {'x': 42, 'y': 0}, None) assert rtn == 42
def test_call_macro_raw_kwarg(arg): def f(x: str): return x rtn = call_macro(f, ["*", "x=" + arg], {"x": 42, "y": 0}, None) assert rtn == 42
def test_call_macro_eval(arg): def f(x: eval): return x rtn = call_macro(f, [arg], {"x": 42, "y": 0}, None) assert rtn == 42
def test_call_macro_ast(arg): def f(x: AST): return x rtn = call_macro(f, [arg], {}, None) assert isinstance(rtn, AST)
def test_call_macro_ast_exec_statement(): def f(x: ("ast", "exec")): return x rtn = call_macro(f, ["x = 5"], {}, None) assert isinstance(rtn, Module)
def test_call_macro_str(arg): def f(x : str): return x rtn = call_macro(f, [arg], None, None) assert rtn is arg
def test_call_macro_ast(arg): def f(x : AST): return x rtn = call_macro(f, [arg], {}, None) assert isinstance(rtn, AST)
def test_call_macro_raw_kwargs(arg): def f(x: str): return x rtn = call_macro(f, ["*", '**{"x" :' + arg + "}"], {"x": 42, "y": 0}, None) assert rtn == 42
def test_call_macro_ast_single_statement(): def f(x: ("ast", "single")): return x rtn = call_macro(f, ["x = 5"], {}, None) assert isinstance(rtn, Interactive)
def test_call_macro_raw_kwargs(arg): def f(x: str): return x rtn = call_macro(f, ['*', '**{"x" :' + arg + '}'], {'x': 42, 'y': 0}, None) assert rtn == 42
def test_call_macro_code(arg): def f(x : compile): return x rtn = call_macro(f, [arg], {}, None) assert isinstance(rtn, types.CodeType)
def test_call_macro_ast_eval_expr(): def f(x: ("ast", "eval")): return x rtn = call_macro(f, ["x == 5"], {}, None) assert isinstance(rtn, Expression)
def test_call_macro_eval(arg): def f(x : eval): return x rtn = call_macro(f, [arg], {'x': 42, 'y': 0}, None) assert rtn == 42
def test_call_macro_exec(arg): def f(x : exec): return x rtn = call_macro(f, [arg], {'x': 42, 'y': 0}, None) assert rtn is None
def test_call_macro_str(arg): def f(x: str): return x rtn = call_macro(f, [arg], None, None) assert rtn is arg
def test_call_macro_raw_kwarg(arg): def f(x : str): return x rtn = call_macro(f, ['*', 'x=' + arg], {'x': 42, 'y': 0}, None) assert rtn == 42
def test_call_macro_code(arg): def f(x: compile): return x rtn = call_macro(f, [arg], {}, None) assert isinstance(rtn, types.CodeType)
def test_call_macro_raw_kwargs(arg): def f(x : str): return x rtn = call_macro(f, ['*', '**{"x" :' + arg + '}'], {'x': 42, 'y': 0}, None) assert rtn == 42
def test_call_macro_exec(arg): def f(x: exec): return x rtn = call_macro(f, [arg], {"x": 42, "y": 0}, None) assert rtn is None
def test_call_macro_eval(arg): def f(x: eval): return x rtn = call_macro(f, [arg], {'x': 42, 'y': 0}, None) assert rtn == 42