def test_deprecated_methods(tmpdir): """Test methods that are scheduled for removal after 0.24.""" r = Report() r.add_projs(info=raw_fname, title='SSP Projectors', tags=('mytag',)) fig = plt.figure() # Empty figure img_fname = op.join(tmpdir, 'testimage.png') fig.savefig(img_fname) with pytest.warns(DeprecationWarning, match='Report.fnames'): assert len(r.fnames) == 1 with pytest.warns(DeprecationWarning, match='Report.sections'): assert len(r.sections) == 1 with pytest.warns(DeprecationWarning, match='use "title" instead'): r.remove(caption='SSP Projectors') with pytest.warns(DeprecationWarning, match='use .* instead'): r.remove(caption='SSP Projectors', tags=('mytag',)) with pytest.warns(DeprecationWarning, match='Use.*Report.add_figure'): with pytest.raises(TypeError, match='It seems you passed a path'): r.add_figs_to_section(['foo'], 'caption', 'section') with pytest.raises( ValueError, match='Number of "captions" and report items must be equal' ): with pytest.warns(DeprecationWarning, match='Use.*Report.add_figure'): r.add_figs_to_section(figs=[fig, fig], captions='H') # Passing lists should work with pytest.warns(DeprecationWarning, match='Use.*Report.add_image'): r.add_images_to_section(fnames=[img_fname], captions=['evoked response']) with pytest.raises( ValueError, match='Number of "captions" and report items must be equal' ): with pytest.warns(DeprecationWarning, match='Use.*Report.add_image'): r.add_images_to_section(fnames=[img_fname, img_fname], captions='H') with pytest.warns(DeprecationWarning, match='Use.*Report.add_bem'): r.add_bem_to_section( subject='sample', subjects_dir=subjects_dir, decim=100 )