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

Appearance settings

Commit 96f97fa

Browse filesBrowse files
committed
simpler example
1 parent 49c1666 commit 96f97fa
Copy full SHA for 96f97fa

File tree

Expand file treeCollapse file tree

2 files changed

+10
-11
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-11
lines changed

‎doc/devel/testing.rst

Copy file name to clipboardExpand all lines: doc/devel/testing.rst
+9-10Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,20 +152,19 @@ tests it::
152152
from matplotlib.testing.decorators import image_comparison
153153
import matplotlib.pyplot as plt
154154

155-
@image_comparison(baseline_images=['hexbin_empty'], remove_text=True,
155+
@image_comparison(baseline_images=['line_dashes'], remove_text=True,
156156
extensions=['png'])
157-
def test_hexbin_empty():
158-
# From #3886: creating hexbin from empty dataset raises ValueError
159-
ax = plt.gca()
160-
ax.hexbin([], [])
157+
def test_line_dashes():
158+
fig, ax = plt.subplots()
159+
ax.plot(range(10), linestyle=(0, (3, 3)), lw=5)
161160

162161
The first time this test is run, there will be no baseline image to compare
163162
against, so the test will fail. Copy the output images (in this case
164-
:file:`result_images/test_axes/hexbin_empty.png`) to the correct subdirectory
165-
of :file:`baseline_images` tree in the source directory (in this case
166-
:file:`lib/matplotlib/tests/baseline_images/test_axes`). Put this new file
167-
under source code revision control (with ``git add``). When rerunning the
168-
tests, they should now pass.
163+
:file:`result_images/test_lines/test_line_dashes.png`) to the correct
164+
subdirectory of :file:`baseline_images` tree in the source directory (in this
165+
case :file:`lib/matplotlib/tests/baseline_images/test_lines`). Put this new
166+
file under source code revision control (with ``git add``). When rerunning
167+
the tests, they should now pass.
169168

170169
Baseline images take a lot of space in the Matplotlib repository.
171170
An alternative approach for image comparison tests is to use the

‎lib/matplotlib/testing/decorators.py

Copy file name to clipboardExpand all lines: lib/matplotlib/testing/decorators.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def image_comparison(baseline_images, extensions=None, tol=0,
368368
either as a parameter or with pytest.mark.usefixtures. This value is
369369
only allowed when using pytest.
370370
371-
extensions : [ None | list ]
371+
extensions : None or list of str
372372
The list of extensions to test, e.g. ``['png', 'pdf']``.
373373
374374
If *None*, defaults to all supported extensions: png, pdf, and svg.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.