From 6661d85323032e5a6e02be4200452ed5afb61f6b Mon Sep 17 00:00:00 2001 From: "Paul R. Tagliamonte" Date: Sun, 3 Mar 2013 11:18:13 -0500 Subject: [PATCH] Add some failing tests in. --- hy/compilers/ast.py | 3 +++ tests/compilers/test_ast.py | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/hy/compilers/ast.py b/hy/compilers/ast.py index 3b718c6..d548550 100644 --- a/hy/compilers/ast.py +++ b/hy/compilers/ast.py @@ -20,6 +20,9 @@ from hy.compilers import HyCompiler +from hy.models.expression import HyExpression +from hy.modesl.symbol import HySymbol + class HyASTCompiler(HyCompiler): diff --git a/tests/compilers/test_ast.py b/tests/compilers/test_ast.py index 4c9f5af..323c543 100644 --- a/tests/compilers/test_ast.py +++ b/tests/compilers/test_ast.py @@ -20,9 +20,23 @@ from hy.compilers.ast import HyASTCompiler from hy.lex import tokenize +import ast def test_ast_expression_basics(): - """ Ensure basic AST conversion works. """ + """ Ensure basic AST expression conversion works. """ compiler = HyASTCompiler() - code = compiler.compile(tokenize("(foo bar)")) + code = compiler.compile(tokenize("(foo bar)"))[0] + tree = ast.Call( + func=ast.Name( + id="foo", + ctx=ast.Load(), + ), + args=[ + ast.Name(id="bar", ctx=ast.Load()) + ], + keywords=[], + starargs=None, + kwargs=None, + ) + assert code == tree