Exemple #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'
Exemple #2
0
def context_state(context):
    context.line = 'one'
    actions.act_state(context)
    return context
Exemple #3
0
def test_state_duplicate(context):
    context.line = 'one'
    actions.act_state(context)
    with pytest.raises(actions.DuplicateName):
        actions.act_state(context)
Exemple #4
0
def test_state_extra_token(context):
    context.line = 'one two'
    with pytest.raises(actions.ExtraToken):
        actions.act_state(context)
Exemple #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']