def test_fails_to_parse(self): e = self.assertParseFailure( combinators.sep_by1(primitives.match(lambda c: c == ","), primitives.match(lambda c: c == "h", {"error!"})), "ello") self.assertEqual({"error!"}, e.expected)
def test_parse_some(self): self.assertParse( combinators.sep_by1(primitives.error({"error!"}), primitives.match(lambda c: c == "h")), ["h"], "ello", "hello")
def test_parses(self): self.assertParse( combinators.sep_by1(primitives.match(lambda c: c == ","), primitives.match(lambda c: c == "h")), ["h", "h", "h"], "ello", "h,h,hello")