def test_string(): check_succ_cont((string('abcde'), 'abcdef'), ('abcde'), 'f') check_type((string('abcde'), 'abcdf'), ParseError, 'f')
def test_or(): check_succ_cont(((digit() >> digit()) | alpha(), '1abc'), 'a', 'bc') check_succ_cont(((digit() >> digit()) | alpha(), '12abc'), '2', 'abc') check_succ_cont(((digit() >> digit()) | alpha(), 'abc'), 'a', 'bc') check_succ_cont(((digit() >> digit()) | alpha(), '123abc'), '2', '3abc') check_succ_cont((string('134') | string('23'), '123abc'), '23', 'abc')
def test_skip_many(): check_succ_cont((skip_many(digit()) >> string('abc'), '9876abcd'), ('abc'), 'd')
def test_between(): check_succ_cont((between(char('['), string('abc'), char(']')), '[abc]'), 'abc', '')
def test_maybe(): check_succ_cont((maybe(spaces()), ' 123'), ([' ', ' ', ' ']), '123') check_succ_cont((maybe(string('12')) | string('13'), '133'), ('13'), '3')