예제 #1
0
def test_protocol_clear_footnotes(steps_before, steps_after, footnotes_before):
    p = Protocol()
    p.steps = steps_before
    p.footnotes = footnotes_before
    p.clear_footnotes()

    assert p.steps == steps_after
    assert p.footnotes == {}
예제 #2
0
def test_protocol_prune_footnotes(steps_before, footnotes_before, steps_after, footnotes_after):
    p = Protocol()
    p.steps = steps_before
    p.footnotes = footnotes_before
    p.prune_footnotes()

    assert p.steps == steps_after
    assert p.footnotes == footnotes_after
예제 #3
0
def test_protocol_renumber_footnotes(new_ids, steps_before, footnotes_before, steps_after, footnotes_after):
    p = Protocol()
    p.steps = steps_before
    p.footnotes = footnotes_before
    p.renumber_footnotes(new_ids)

    assert p.steps == steps_after
    assert p.footnotes == footnotes_after
예제 #4
0
def test_protocol_format_everything():
    """
    Just make sure the spacing between all the elements looks right.
    """
    p = Protocol()
    p.date = arrow.get(1988, 11, 8)
    p.commands = ['sw cmd-1', 'sw cmd-2']
    p.steps = ['Step 1', 'Step 2']
    p.footnotes = {1: 'Footnote 1', 2: 'Footnote 2'}
    assert p.format_text(inf) == """\
예제 #5
0
def test_protocol_insert_footnotes(steps_before, footnotes_before, footnotes_new, pattern, steps_after, footnotes_after, error):
    p = Protocol()
    p.steps = steps_before
    p.footnotes = footnotes_before

    with error:
        p.insert_footnotes(*footnotes_new, pattern=pattern)

        assert p.steps == steps_after
        assert p.footnotes == footnotes_after
예제 #6
0
def test_protocol_format_steps(steps, expected):
    p = Protocol()
    p.steps = steps
    assert p.format_text(inf) == expected.rstrip()
예제 #7
0
def test_protocol_merge_footnotes(steps_before, steps_after):
    p = Protocol()
    p.steps = steps_before
    p.merge_footnotes()
    assert p.steps == steps_after