def TODO_test_keywordFailed(self): """ On failure, L{OMetaBase.rule_keyword} produces an error indicating the position where match failure occurred and the expected character. """ data = "foozle" o = OMetaBase(data) try: o.rule_keyword('foo') except _MaybeParseError, e: self.assertEqual(e[0], 4) self.assertEqual(e[1], expected("keyword", "foo")) self.assertEqual(o.input.position, 0) self.assertEqual(o.input.head()[0], 'f')
def test_keyword(self): """ L{OMetaBase.rule_keyword} matches all the characters in the given string. """ o = OMetaBase("foo bar") v, e = o.rule_keyword("foo") self.assertEqual(v, { 'keyword':"foo", 'prefix':[] })