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)))
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)))
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)
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)