def test_without_matching(self): grammar = Grammar('grammars/route_samples.grammar', classifier=SampleClassifier()) state = State(grammar, 'sample', 6) token = Token('char', 'c') self.assertFalse(router.has_matching_successor(state, token))
def test_multiple_matching(self): grammar = Grammar('grammars/route_samples.grammar', classifier=SampleClassifier()) state = State(grammar, 'sample', 2) token = Token('char', '*') with self.assertRaises(RuntimeError): _ = router.has_matching_successor(state, token)
def test_indirect_matching(self): grammar = Grammar('grammars/route_samples.grammar', classifier=SampleClassifier()) state = State(grammar, 'sample', 2) token = Token('char', 'b') self.assertTrue(router.has_matching_successor(state, token))