diff --git a/hy/compiler.py b/hy/compiler.py index 33cc90d..daa3aae 100644 --- a/hy/compiler.py +++ b/hy/compiler.py @@ -534,8 +534,8 @@ class HyASTCompiler(object): @builds("global") @checkargs(1) - def compile_global_expression(self,expr): - expr.pop(0) # global + def compile_global_expression(self, expr): + expr.pop(0) # global e = expr.pop(0) return ast.Global(names=[ast_str(e)], lineno=e.start_line, diff --git a/tests/compilers/test_ast.py b/tests/compilers/test_ast.py index 148aa91..59e01ba 100644 --- a/tests/compilers/test_ast.py +++ b/tests/compilers/test_ast.py @@ -185,15 +185,18 @@ def test_ast_bad_assert(): cant_compile("(assert)") cant_compile("(assert 1 2)") + def test_ast_good_global(): "Make sure AST can compile valid global" hy_compile(tokenize("(global a)")) + def test_ast_bad_global(): "Make sure AST can't compile invalid global" cant_compile("(global)") cant_compile("(global foo bar)") + def test_ast_good_lambda(): "Make sure AST can compile valid lambda" hy_compile(tokenize("(lambda [] 1)"))