Exemple #1
0
 def test_get_valid_actions_uses_top_of_stack(self):
     s_actions = object()
     t_actions = object()
     e_actions = object()
     state = GrammarStatelet(["s"], {
         "s": s_actions,
         "t": t_actions
     }, is_nonterminal)
     assert state.get_valid_actions() == s_actions
     state = GrammarStatelet(["t"], {
         "s": s_actions,
         "t": t_actions
     }, is_nonterminal)
     assert state.get_valid_actions() == t_actions
     state = GrammarStatelet(["e"], {
         "s": s_actions,
         "t": t_actions,
         "e": e_actions
     }, is_nonterminal)
     assert state.get_valid_actions() == e_actions
Exemple #2
0
 def test_get_valid_actions_uses_top_of_stack(self):
     s_actions = object()
     t_actions = object()
     e_actions = object()
     state = GrammarStatelet(['s'], {
         's': s_actions,
         't': t_actions
     }, is_nonterminal)
     assert state.get_valid_actions() == s_actions
     state = GrammarStatelet(['t'], {
         's': s_actions,
         't': t_actions
     }, is_nonterminal)
     assert state.get_valid_actions() == t_actions
     state = GrammarStatelet(['e'], {
         's': s_actions,
         't': t_actions,
         'e': e_actions
     }, is_nonterminal)
     assert state.get_valid_actions() == e_actions