2021-06-29 | Paul Boddie | file changeset files shortlog | Renamed the utf8string class to unicode, eliminating the unicode function. This means that the simple case of merely returning an object if it is already a Unicode object no longer occurs when using the unicode callable, but such behaviour might be better supported with more general customised instantiation functionality. |
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 |