コード例 #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))
コード例 #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)
コード例 #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))