def test_fails_to_parse_ll2(self): e = self.assertParseFailure( combinators.try_(combinators.sequence( primitives.any_, primitives.any_, primitives.error({"error!"}))), "test") self.assertEqual({"error!"}, e.expected)
def test_parses(self): self.assertParse(combinators.try_(primitives.match(lambda c: c == "h")), "h", "ello", "hello")
def test_fails_to_parse(self): e = self.assertParseFailure( combinators.try_(primitives.error({"error!"})), "hello") self.assertEqual({"error!"}, e.expected)