hy/tests/test_lex.py

20 lines
608 B
Python
Raw Normal View History

2013-03-01 04:37:23 +01:00
from hy.models.expression import HyExpression
2013-03-03 01:28:10 +01:00
from hy.models.integer import HyInteger
2013-03-01 04:37:23 +01:00
from hy.models.symbol import HySymbol
2013-03-03 00:40:00 +01:00
from hy.models.string import HyString
2013-03-01 04:27:20 +01:00
2013-03-03 01:28:10 +01:00
from hy.lex import tokenize
2013-03-01 04:27:20 +01:00
2013-03-03 00:40:00 +01:00
def test_lex_expression_symbols():
2013-03-01 04:27:20 +01:00
objs = tokenize("(foo bar)")
2013-03-01 04:37:23 +01:00
assert objs == [HyExpression([HySymbol("foo"), HySymbol("bar")])]
2013-03-03 00:40:00 +01:00
def test_lex_expression_strings():
objs = tokenize("(foo \"bar\")")
assert objs == [HyExpression([HySymbol("foo"), HyString("bar")])]
2013-03-03 01:28:10 +01:00
def test_lex_expression_integer():
objs = tokenize("(foo 2)")
assert objs == [HyExpression([HySymbol("foo"), HyInteger(2)])]