Ejemplo n.º 1
0
 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))
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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))