Exemplo n.º 1
0
 def test_fails_to_parse_front(self):
     e = self.assertParseFailure(
         combinators.between(primitives.error({"error!"}),
                             primitives.match(lambda c: c == "l"),
                             primitives.match(lambda c: c == "e")),
         "hello")
     self.assertEqual({"error!"}, e.expected)
Exemplo n.º 2
0
 def test_fails_to_parse_back(self):
     e = self.assertSimpleParseFailure(
         combinators.between(primitives.match(lambda c: c == "h"),
                             primitives.error({"error!"}),
                             primitives.match(lambda c: c == "e")),
         "hello")
     self.assertEqual("l", e.value)
     self.assertEqual(list("lo"), list(e.it))
     self.assertEqual({"error!"}, e.expected)
Exemplo n.º 3
0
 def test_parses(self):
     self.assertParse(
         combinators.between(primitives.match(lambda c: c == "h"),
                             primitives.match(lambda c: c == "l"),
                             primitives.match(lambda c: c == "e")),
         "e", "lo", "hello")