|
11 | 11 | import matplotlib as mpl
|
12 | 12 | from matplotlib import dviread, pyplot as plt, checkdep_usetex, rcParams
|
13 | 13 | from matplotlib.backends.backend_pdf import PdfPages
|
14 |
| -from matplotlib.testing.compare import compare_images |
15 |
| -from matplotlib.testing.decorators import image_comparison |
| 14 | +from matplotlib.testing.decorators import check_figures_equal, image_comparison |
16 | 15 |
|
17 | 16 |
|
18 | 17 | needs_usetex = pytest.mark.skipif(
|
@@ -245,16 +244,13 @@ def psfont(*args, **kwargs):
|
245 | 244 |
|
246 | 245 |
|
247 | 246 | @pytest.mark.style('default')
|
248 |
| -def test_pdf_savefig_when_color_is_none(tmpdir): |
249 |
| - fig, ax = plt.subplots() |
250 |
| - plt.axis('off') |
251 |
| - ax.plot(np.sin(np.linspace(-5, 5, 100)), 'v', c='none') |
252 |
| - actual_image = tmpdir.join('figure.pdf') |
253 |
| - expected_image = tmpdir.join('figure.eps') |
254 |
| - fig.savefig(str(actual_image), format='pdf') |
255 |
| - fig.savefig(str(expected_image), format='eps') |
256 |
| - result = compare_images(str(actual_image), str(expected_image), 0) |
257 |
| - assert result is None |
| 247 | +@check_figures_equal(extensions=["pdf", "eps"]) |
| 248 | +def test_pdf_eps_savefig_when_color_is_none(fig_test, fig_ref): |
| 249 | + ax_test = fig_test.add_subplot() |
| 250 | + ax_test.set_axis_off() |
| 251 | + ax_test.plot(np.sin(np.linspace(-5, 5, 100)), "v", c="none") |
| 252 | + ax_ref = fig_ref.add_subplot() |
| 253 | + ax_ref.set_axis_off() |
258 | 254 |
|
259 | 255 |
|
260 | 256 | @needs_usetex
|
|
0 commit comments