예제 #1
0
def test_first_state(context):
    assert context.first_state is None
    context.line = 'one'
    actions.act_state(context)
    assert context.first_state == 'one'
    context.line = 'two'
    actions.act_state(context)
    assert context.first_state == 'one'
예제 #2
0
def context_state(context):
    context.line = 'one'
    actions.act_state(context)
    return context
예제 #3
0
def test_state_duplicate(context):
    context.line = 'one'
    actions.act_state(context)
    with pytest.raises(actions.DuplicateName):
        actions.act_state(context)
예제 #4
0
def test_state_extra_token(context):
    context.line = 'one two'
    with pytest.raises(actions.ExtraToken):
        actions.act_state(context)
예제 #5
0
def test_state(context):
    assert len(context.states) == 0
    context.line = 'one'
    actions.act_state(context)
    assert len(context.states) == 1
    assert context.states['one']