def test_remove():
    'Test removing figures from a report.'
    r = Report()
    (fig1, fig2) = _get_example_figures()
    r.add_figs_to_section(fig1, 'figure1', 'mysection')
    r.add_slider_to_section([fig1, fig2], title='figure1', section='othersection')
    r.add_figs_to_section(fig2, 'figure1', 'mysection')
    r.add_figs_to_section(fig2, 'figure2', 'mysection')
    r2 = copy.deepcopy(r)
    removed_index = r2.remove(caption='figure1')
    assert (removed_index == 2)
    assert (len(r2.html) == 3)
    assert (r2.html[0] == r.html[0])
    assert (r2.html[1] == r.html[1])
    assert (r2.html[2] == r.html[3])
    r2 = copy.deepcopy(r)
    removed_index = r2.remove(caption='figure1', section='othersection')
    assert (removed_index == 1)
    assert (len(r2.html) == 3)
    assert (r2.html[0] == r.html[0])
    assert (r2.html[1] == r.html[2])
    assert (r2.html[2] == r.html[3])
    r2 = copy.deepcopy(r)
    r2.remove(caption='figure1', section='othersection')
    assert (r2.sections == ['mysection'])
    assert (r2._sectionvars == {'mysection': 'report_mysection'})
Test removing figures from a report.
def test_remove():
    
    r = Report()
    (fig1, fig2) = _get_example_figures()
    r.add_figs_to_section(fig1, 'figure1', 'mysection')
    r.add_slider_to_section([fig1, fig2], title='figure1', section='othersection')
    r.add_figs_to_section(fig2, 'figure1', 'mysection')
    r.add_figs_to_section(fig2, 'figure2', 'mysection')
    r2 = copy.deepcopy(r)
    removed_index = r2.remove(caption='figure1')
    assert (removed_index == 2)
    assert (len(r2.html) == 3)
    assert (r2.html[0] == r.html[0])
    assert (r2.html[1] == r.html[1])
    assert (r2.html[2] == r.html[3])
    r2 = copy.deepcopy(r)
    removed_index = r2.remove(caption='figure1', section='othersection')
    assert (removed_index == 1)
    assert (len(r2.html) == 3)
    assert (r2.html[0] == r.html[0])
    assert (r2.html[1] == r.html[2])
    assert (r2.html[2] == r.html[3])
    r2 = copy.deepcopy(r)
    r2.remove(caption='figure1', section='othersection')
    assert (r2.sections == ['mysection'])
    assert (r2._sectionvars == {'mysection': 'report_mysection'})