Lichen

Annotated pyparser/test/test_gendfa.py

860:21f92740b225
2018-07-22 Paul Boddie Merged changes from the default branch. trailing-data
paul@437 1
from pyparser.automata import DFA, DEFAULT
paul@437 2
from pyparser.genpytokenize import output
paul@437 3
paul@437 4
def test_states():
paul@437 5
    states = [{"\x00": 1}, {"\x01": 0}]
paul@437 6
    d = DFA(states[:], [False, True])
paul@437 7
    assert output('test', DFA, d, states) == """\
paul@437 8
accepts = [False, True]
paul@437 9
states = [
paul@437 10
    # 0
paul@437 11
    {'\\x00': 1},
paul@437 12
    # 1
paul@437 13
    {'\\x01': 0},
paul@437 14
    ]
paul@437 15
test = automata.pyparser.automata.DFA(states, accepts)
paul@437 16
"""