Skip to content

Commit d393d23

Browse files
committed
TST: Set check_figures_equal default to PNG only
1 parent 0224c3c commit d393d23

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+215
-210
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
``matplotlib.testing.check_figures_equal`` defaults to PNG only
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
In most cases, checking that figures are equal with `.check_figures_equal` does not
5+
depend on the file format. Consequently, the *extensions* parameter now defaults to
6+
``['png']`` instead of ``['png', 'pdf', 'svg']``, reducing default test requirements.

doc/devel/testing.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ vs plotting the circle using the parametric equation of a circle ::
191191
@check_figures_equal()
192192
def test_parametric_circle_plot(fig_test, fig_ref):
193193

194-
xo, yo= (.5, .5)
194+
xo = yo = 0.5
195195
radius = 0.4
196196

197197
ax_test = fig_test.subplots()
@@ -205,7 +205,7 @@ vs plotting the circle using the parametric equation of a circle ::
205205
ax_ref.add_artist(red_circle_ref)
206206

207207
for ax in [ax_ref, ax_test]:
208-
ax.set(xlim=(0,1), ylim=(0,1), aspect='equal')
208+
ax.set(xlim=(0, 1), ylim=(0, 1), aspect='equal')
209209

210210
Both comparison decorators have a tolerance argument ``tol`` that is used to specify the
211211
tolerance for difference in color value between the two images, where 255 is the maximal

lib/matplotlib/testing/decorators.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ def image_comparison(baseline_images, extensions=None, tol=0,
347347
savefig_kwargs=savefig_kwarg, style=style)
348348

349349

350-
def check_figures_equal(*, extensions=("png", "pdf", "svg"), tol=0):
350+
def check_figures_equal(*, extensions=("png", ), tol=0):
351351
"""
352352
Decorator for test cases that generate and compare two figures.
353353
@@ -360,7 +360,7 @@ def check_figures_equal(*, extensions=("png", "pdf", "svg"), tol=0):
360360
361361
Parameters
362362
----------
363-
extensions : list, default: ["png", "pdf", "svg"]
363+
extensions : list, default: ["png"]
364364
The extensions to test.
365365
tol : float
366366
The RMS threshold above which the test is considered failed.

lib/matplotlib/tests/test_animation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ def update(frame):
428428
anim._start()
429429

430430

431-
@check_figures_equal(extensions=["png"])
431+
@check_figures_equal()
432432
def test_animation_frame(tmp_path, fig_test, fig_ref):
433433
# Test the expected image after iterating through a few frames
434434
# we save the animation to get the iteration because we are not

lib/matplotlib/tests/test_artist.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def test_clipping():
124124
ax1.set_ylim([-3, 3])
125125

126126

127-
@check_figures_equal(extensions=['png'])
127+
@check_figures_equal()
128128
def test_clipping_zoom(fig_test, fig_ref):
129129
# This test places the Axes and sets its limits such that the clip path is
130130
# outside the figure entirely. This should not break the clip path.

0 commit comments

Comments
 (0)