示例#1
0
 def test_fails_to_parse_second(self):
     e = self.assertSimpleParseFailure(
         combinators.count(5, primitives.match(lambda c: c == "h",
                                               {"error!"})),
         "hello")
     self.assertEqual("e", e.value)
     self.assertEqual(list("llo"), list(e.it))
     self.assertEqual({"error!"}, e.expected)
示例#2
0
文件: parser.py 项目: rfw/kessel
 def __rmul__(self, n):
     return Parser(combinators.count(n, self))
示例#3
0
 def test_fails_to_parse(self):
     e = self.assertParseFailure(
         combinators.count(1, primitives.error({"error!"})), "hello")
     self.assertEqual({"error!"}, e.expected)
示例#4
0
 def test_parses(self):
     self.assertParse(
         combinators.count(5, primitives.any_), list("hello"), "", "hello")