Lichen

Annotated pyparser/test/test_automata.py

909:5c6b1b19c6f6
2019-06-11 Paul Boddie Added an inline commentary of the "for" loop construct.
paul@437 1
from pyparser.automata import DFA, DEFAULT
paul@437 2
paul@437 3
def test_states():
paul@437 4
    d = DFA([{"\x00": 1}, {"\x01": 0}], [False, True])
paul@437 5
    assert d.states == "\x01\xff\xff\x00"
paul@437 6
    assert d.defaults == "\xff\xff"
paul@437 7
    assert d.max_char == 2
paul@437 8
paul@437 9
    d = DFA([{"\x00": 1}, {DEFAULT: 0}], [False, True])
paul@437 10
    assert d.states == "\x01\x00"
paul@437 11
    assert d.defaults == "\xff\x00"
paul@437 12
    assert d.max_char == 1