Skip to content

Commit 9ff4f49

Browse files
committed
TST: update tests to account for functions that plot
1 parent 1c6f55b commit 9ff4f49

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

lib/matplotlib/tests/test_sphinxext.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def plot_directive_file(num):
7777
assert b'# Only a comment' in html_contents
7878
# check plot defined in external file.
7979
assert filecmp.cmp(range_4, img_dir / 'range4.png')
80-
assert filecmp.cmp(range_6, img_dir / 'range6.png')
80+
assert filecmp.cmp(range_6, img_dir / 'range6_range6.png')
8181
# check if figure caption made it into html file
8282
assert b'This is the caption for plot 15.' in html_contents
8383
# check if figure caption using :caption: made it into html file
@@ -91,6 +91,8 @@ def plot_directive_file(num):
9191
# Plot 21 is range(6) plot via an include directive. But because some of
9292
# the previous plots are repeated, the argument to plot_file() is only 17.
9393
assert filecmp.cmp(range_6, plot_file(17))
94+
# plot 22 is from the range6.py file again, but a different function
95+
assert filecmp.cmp(range_10, img_dir / 'range6_range10.png')
9496

9597
# Modify the included plot
9698
contents = (tmp_path / 'included_plot_21.rst').read_bytes()

lib/matplotlib/tests/tinypages/range6.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,10 @@ def range6():
1111
plt.figure()
1212
plt.plot(range(6))
1313
plt.show()
14+
15+
16+
def range10():
17+
"""The function that should be executed."""
18+
plt.figure()
19+
plt.plot(range(10))
20+
plt.show()

lib/matplotlib/tests/tinypages/some_plots.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,11 @@ scenario:
168168

169169
plt.figure()
170170
plt.plot(range(4))
171-
171+
172172
Plot 21 is generated via an include directive:
173173

174174
.. include:: included_plot_21.rst
175175

176+
Plot 22 uses a different specific function in a file with plot commands:
177+
178+
.. plot:: range6.py range10

0 commit comments

Comments
 (0)