# Path: tests/util/asserts.py
# def assert_that(obj, matcher):
#     assert_implements(obj, object)
#     assert_implements(matcher, Matcher)
#     if not matcher.matches(obj):
#         raise AssertionError(matcher.description())
# 
# def equals(expected):
#     class EqualsMatcher:
# 
#         def __init__(self, expected):
#             self.expected = expected
# 
#         def matches(self, actual):
#             self.actual = actual
#             return actual == expected
# 
#         def description(self):
#             ret = (
#                 repr(self.actual)
#                 + " does not equal "
#                 + repr(self.expected)
#                 + " as expected."
#             )
#             if len(ret) > 80:
#                 ret = """Values are not equal (actual then expected):
# %s
# %s
# """ % ( repr(self.actual), repr(self.expected))
#             return ret
#     return EqualsMatcher(expected)
# 
# def fail(msg):
#     raise AssertionError(msg)
# 
# Path: tests/util/test.py
# def test(t):
#     return TestFunctionType(t)
# 
# Path: tests/util/system_test.py

# 
# Path: tests/util/all_examples.py
# def all_examples(file_ext=".cell"):
#     return (
#         "examples/" + filename
#         for filename in os.listdir("examples")
#         if filename.endswith(file_ext)
#     )
# 
# Path: pycell/lexer.py
# def lex(chars_iter):
#     chars = PeekableStream(chars_iter)
#     while chars.next is not None:
#         c = chars.move_next()
#         if c in " \n":              pass           # Ignore white space
#         elif c in "(){},;=:":       yield (c, "")  # Special characters
#         elif c in "+-*/":           yield ("operation", c)
#         elif c in ("'", '"'):       yield ("string", _scan_string(c, chars))
#         elif re.match("[.0-9]", c): yield ("number", _scan(c, chars, "[.0-9]"))
#         elif re.match("[_a-zA-Z]", c):
#             yield ("symbol", _scan(c, chars, "[_a-zA-Z0-9]"))
#         elif c == "\t":
#             raise Exception("Tab characters are not allowed in Cell.")
#         else:
#             raise Exception("Unrecognised character: '" + c + "'.")


from tests.util.asserts import assert_that, equals, fail
from tests.util.test import test
from tests.util.system_test import system_test
from tests.util.all_examples import all_examples
from pycell.lexer import lex
    from pycell.chars_in_file import chars_in_file
@test
def Commas_produce_comma_tokens():
    assert_that(lexed(","), equals([(",", "")]))


@test
def Equals_produces_an_equals_token():
    assert_that(lexed("="), equals([("=", "")]))


@test
def Semicolons_produce_semicolon_tokens():
    assert_that(lexed(";"), equals([(";", "")]))


@test
def Colons_produce_colon_tokens():
    assert_that(lexed(":"), equals([(":", "")]))


@test
def Arithmetic_operators_produce_operation_tokens():
    assert_that(lexed("+"), equals([("operation", "+")]))
    assert_that(lexed("-"), equals([("operation", "-")]))
    assert_that(lexed("*"), equals([("operation", "*")]))
    assert_that(lexed("/"), equals([("operation", "/")]))


@test
def Multiple_token_types_can_be_combined():

# Path: tests/util/asserts.py
# def assert_that(obj, matcher):
#     assert_implements(obj, object)
#     assert_implements(matcher, Matcher)
#     if not matcher.matches(obj):
#         raise AssertionError(matcher.description())
# 
# def equals(expected):
#     class EqualsMatcher:
# 
#         def __init__(self, expected):
#             self.expected = expected
# 
#         def matches(self, actual):
#             self.actual = actual
#             return actual == expected
# 
#         def description(self):
#             ret = (
#                 repr(self.actual)
#                 + " does not equal "
#                 + repr(self.expected)
#                 + " as expected."
#             )
#             if len(ret) > 80:
#                 ret = """Values are not equal (actual then expected):
# %s
# %s
# """ % ( repr(self.actual), repr(self.expected))
#             return ret
#     return EqualsMatcher(expected)
# 
# def fail(msg):
#     raise AssertionError(msg)
# 
# Path: tests/util/test.py
# def test(t):
#     return TestFunctionType(t)
# 
# Path: tests/util/system_test.py

# 
# Path: tests/util/all_examples.py
# def all_examples(file_ext=".cell"):
#     return (
#         "examples/" + filename
#         for filename in os.listdir("examples")
#         if filename.endswith(file_ext)
#     )
# 
# Path: pycell/lexer.py
# def lex(chars_iter):
#     chars = PeekableStream(chars_iter)
#     while chars.next is not None:
#         c = chars.move_next()
#         if c in " \n":              pass           # Ignore white space
#         elif c in "(){},;=:":       yield (c, "")  # Special characters
#         elif c in "+-*/":           yield ("operation", c)
#         elif c in ("'", '"'):       yield ("string", _scan_string(c, chars))
#         elif re.match("[.0-9]", c): yield ("number", _scan(c, chars, "[.0-9]"))
#         elif re.match("[_a-zA-Z]", c):
#             yield ("symbol", _scan(c, chars, "[_a-zA-Z0-9]"))
#         elif c == "\t":
#             raise Exception("Tab characters are not allowed in Cell.")
#         else:
#             raise Exception("Unrecognised character: '" + c + "'.")


# Path: tests/lexer_tests.py
from tests.util.asserts import assert_that, equals, fail
from tests.util.test import test
from tests.util.system_test import system_test
from tests.util.all_examples import all_examples
from pycell.lexer import lex
    from pycell.chars_in_file import chars_in_file

@test
def Commas_produce_comma_tokens():
    assert_that(lexed(","), equals([(",", "")]))


@test
def Equals_produces_an_equals_token():
    assert_that(lexed("="), equals([("=", "")]))


@test
def Semicolons_produce_semicolon_tokens():
    assert_that(lexed(";"), equals([(";", "")]))


@test
def Colons_produce_colon_tokens():
    assert_that(lexed(":"), equals([(":", "")]))


@test
def Arithmetic_operators_produce_operation_tokens():
    assert_that(lexed("+"), equals([("operation", "+")]))
    assert_that(lexed("-"), equals([("operation", "-")]))
    assert_that(lexed("*"), equals([("operation", "*")]))
    assert_that(lexed("/"), equals([("operation", "/")]))


@test
def Multiple_token_types_can_be_combined():

    assert_that(