Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 662239c

Browse files
Merge pull request matplotlib#29827 from QuLogic/test-reduction
TST: Remove unnecessary test images
2 parents 9f0cdfd + 44bc05c commit 662239c

File tree

206 files changed

+273
-105942
lines changed

Some content is hidden

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

206 files changed

+273
-105942
lines changed
Lines changed: 6 additions & 0 deletions
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‎

Lines changed: 2 additions & 2 deletions
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‎

Lines changed: 8 additions & 3 deletions
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,8 +360,13 @@ def check_figures_equal(*, extensions=("png", "pdf", "svg"), tol=0):
360360
361361
Parameters
362362
----------
363-
extensions : list, default: ["png", "pdf", "svg"]
364-
The extensions to test.
363+
extensions : list, default: ["png"]
364+
The extensions to test. Supported extensions are "png", "pdf", "svg".
365+
366+
Testing with the one default extension is sufficient if the output is not
367+
format dependent, e.g. if you test that a ``bar()`` plot yields the same
368+
result as some manually placed Rectangles. You should use all extensions
369+
if a renderer property is involved, e.g. correct alpha blending.
365370
tol : float
366371
The RMS threshold above which the test is considered failed.
367372
-6.13 KB
Binary file not shown.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /