Naming the tests, etc.
This commit is contained in:
parent
3a630303dc
commit
627ae0ffa5
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user