Exemplo n.º 1
0
def test_gold_left_oracle(string, gold):
    state = PyState(string, gold=gold)
    state.transition('S')
    assert state.is_gold('L-SUBJ')
    assert not state.is_gold('L-OTHER')
    assert not state.is_gold('S')
    assert not state.is_gold('D')
    assert not state.is_gold('R-OBJ')
    state.transition('L-SUBJ')
    assert not state.is_valid('L-SUBJ')
    assert not state.is_valid('R-OTHER')
    assert not state.is_valid('D')
    assert state.is_gold('S')
    state.transition('S')
    state.transition('S')
    assert not state.is_gold('L-SUBJ')
    assert state.is_gold('L-OTHER')
    assert not state.is_gold('S')
    assert not state.is_gold('D')
    assert not state.is_gold('R-OBJ')
Exemplo n.º 2
0
def test_gold_left_oracle(string, gold):
    state = PyState(string, gold=gold)
    state.transition('S')
    assert state.is_gold('L-SUBJ')
    assert not state.is_gold('L-OTHER')
    assert not state.is_gold('S')
    assert not state.is_gold('D')
    assert not state.is_gold('R-OBJ')
    state.transition('L-SUBJ')
    assert not state.is_valid('L-SUBJ')
    assert not state.is_valid('R-OTHER')
    assert not state.is_valid('D')
    assert state.is_gold('S')
    state.transition('S')
    state.transition('S')
    assert not state.is_gold('L-SUBJ')
    assert state.is_gold('L-OTHER')
    assert not state.is_gold('S')
    assert not state.is_gold('D')
    assert not state.is_gold('R-OBJ')
Exemplo n.º 3
0
def test_sunk_right(string, gold):
    state = PyState(string, gold=gold)
    state.transition('S')
    assert state.top == 1
    assert not state.is_gold('R-OBJ')
    assert state.top == 1
    state.transition('R-OBJ')
    assert state.top == 2
    assert not state.is_gold('D')
    state.transition('D')
    assert not state.is_gold('R-OBJ')
    state.transition('R-OBJ')
    assert state.is_gold('D')
    assert not state.is_gold('L-OTHER')
    assert not state.is_valid('L-OTHER')
Exemplo n.º 4
0
def test_sunk_right(string, gold):
    state = PyState(string, gold=gold)
    state.transition('S')
    assert state.top == 1
    assert not state.is_gold('R-OBJ')
    assert state.top == 1
    state.transition('R-OBJ')
    assert state.top == 2
    assert not state.is_gold('D')
    state.transition('D')
    assert not state.is_gold('R-OBJ')
    state.transition('R-OBJ')
    assert state.is_gold('D')
    assert not state.is_gold('L-OTHER')
    assert not state.is_valid('L-OTHER')
Exemplo n.º 5
0
def test_left_invalid(string):
    state = PyState(string, transitions=['S', 'R-OBJ'])
    assert not state.is_valid('L-SUBJ')
Exemplo n.º 6
0
def test_reduce_valid(string):
    state = PyState(string, transitions=['S', 'R-OBJ'])
    assert state.is_valid('D')
Exemplo n.º 7
0
def test_reduce_invalid(string):
    state = PyState(string, transitions=['S'])
    assert not state.is_valid('D')
Exemplo n.º 8
0
def test_left_valid(string):
    state = PyState(string, transitions=['S'])
    assert state.is_valid('L-SUBJ')
Exemplo n.º 9
0
def test_right_valid(string):
    state = PyState(string, transitions=['S'])
    assert state.is_valid('R-OBJ')
Exemplo n.º 10
0
def test_init_valid(string):
    state = PyState(string)
    assert state.is_valid('S')
    assert not state.is_valid('D')
    assert not state.is_valid('R-OBJ')
    assert not state.is_valid('L-SUBJ')
Exemplo n.º 11
0
def test_left_invalid(string):
    state = PyState(string, transitions=['S', 'R-OBJ'])
    assert not state.is_valid('L-SUBJ')
Exemplo n.º 12
0
def test_reduce_valid(string):
    state = PyState(string, transitions=['S', 'R-OBJ'])
    assert state.is_valid('D')
Exemplo n.º 13
0
def test_reduce_invalid(string):
    state = PyState(string, transitions=['S'])
    assert not state.is_valid('D')
Exemplo n.º 14
0
def test_left_valid(string):
    state = PyState(string, transitions=['S'])
    assert state.is_valid('L-SUBJ')
Exemplo n.º 15
0
def test_right_valid(string):
    state = PyState(string, transitions=['S'])
    assert state.is_valid('R-OBJ')
Exemplo n.º 16
0
def test_init_valid(string):
    state = PyState(string)
    assert state.is_valid('S')
    assert not state.is_valid('D')
    assert not state.is_valid('R-OBJ')
    assert not state.is_valid('L-SUBJ')