예제 #1
0
 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)
예제 #2
0
 def test_parse_some(self):
     self.assertParse(
         combinators.sep_by1(primitives.error({"error!"}),
                             primitives.match(lambda c: c == "h")),
         ["h"], "ello", "hello")
예제 #3
0
 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")