Naming the tests, etc.

This commit is contained in:
Paul R. Tagliamonte 2013-03-02 19:48:29 -05:00
parent 3a630303dc
commit 627ae0ffa5

View File

@ -3,25 +3,40 @@ from hy.models.integer import HyInteger
from hy.models.symbol import HySymbol
from hy.models.string import HyString
from hy.lex.states import LexException
from hy.lex import tokenize
def test_lex_exception():
""" Ensure tokenize throws a fit on a partial input """
try:
objs = tokenize("(foo")
assert True == False
except LexException:
pass
def test_lex_expression_symbols():
""" Make sure that expressions produce symbols """
objs = tokenize("(foo bar)")
assert objs == [HyExpression([HySymbol("foo"), HySymbol("bar")])]
def test_lex_expression_strings():
""" Test that expressions can produce symbols """
objs = tokenize("(foo \"bar\")")
assert objs == [HyExpression([HySymbol("foo"), HyString("bar")])]
def test_lex_expression_integer():
""" Make sure expressions can produce integers """
objs = tokenize("(foo 2)")
assert objs == [HyExpression([HySymbol("foo"), HyInteger(2)])]
def test_lex_line_counting():
""" Make sure we can count lines / columns """
entry = tokenize("(foo 2)")[0]
assert entry.start_line == 1