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 == {}
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
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
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) == """\
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
def test_protocol_format_steps(steps, expected): p = Protocol() p.steps = steps assert p.format_text(inf) == expected.rstrip()
def test_protocol_merge_footnotes(steps_before, steps_after): p = Protocol() p.steps = steps_before p.merge_footnotes() assert p.steps == steps_after