Exemplo n.º 1
0
 def test_listpattern(self):
     """
     L{OMetaBase.rule_listpattern} matches contents of lists.
     """
     o = OMetaBase([["a"]], tree=True)
     v, e = o.listpattern(lambda: o.exactly("a"))
     self.assertEqual((v, e), (["a"], ParseError("a", 0, None)))
Exemplo n.º 2
0
 def test_listpattern(self):
     """
     L{OMetaBase.rule_listpattern} matches contents of lists.
     """
     o = OMetaBase([["a"]], tree=True)
     v, e = o.listpattern(lambda: o.exactly("a"))
     self.assertEqual((v, e), (["a"], ParseError("a", 0, None)))
Exemplo n.º 3
0
    def test_notError(self):
        """
        When L{OMetaBase._not} fails, its error contains the current
        input position and no error info.
        """

        data = "xy"
        o = OMetaBase(data)
        exc = self.assertRaises(ParseError, o._not, lambda: o.exactly("x"))
        self.assertEqual(exc.args[0], 1)
        self.assertEqual(exc.args[1], None)
Exemplo n.º 4
0
    def test_notError(self):
        """
        When L{OMetaBase._not} fails, its error contains the current
        input position and no error info.
        """

        data = "xy"
        o = OMetaBase(data)
        exc = self.assertRaises(ParseError, o._not, lambda: o.exactly("x"))
        self.assertEqual(exc.args[0], 1)
        self.assertEqual(exc.args[1], None)