8000 TST: update tests to account for functions that plot · matplotlib/matplotlib@4030ff4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4030ff4

Browse files
committed
TST: update tests to account for functions that plot
1 parent e097a7e commit 4030ff4

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
@@ -81,7 +81,7 @@ def plot_directive_file(num):
8181
assert b'# Only a comment' in html_contents
8282
# check plot defined in external file.
8383
assert filecmp.cmp(range_4, img_dir / 'range4.png')
84-
assert filecmp.cmp(range_6, img_dir / 'range6.png')
84+
assert filecmp.cmp(range_6, img_dir / 'range6_range6.png')
8585
# check if figure caption made it into html file
8686
assert b'This is the caption for plot 15.' in html_contents
8787
# check if figure caption using :caption: made it into html file
@@ -95,6 +95,8 @@ def plot_directive_file(num):
9595
# Plot 21 is range(6) plot via an include directive. But because some of
9696
# the previous plots are repeated, the argument to plot_file() is only 17.
9797
assert filecmp.cmp(range_6, plot_file(17))
98+
# plot 22 is from the range6.py file again, but a different function
99+
assert filecmp.cmp(range_10, img_dir / 'range6_range10.png')
98100

99101
# Modify the included plot
100102
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)
0