Skip to content

Commit 20bed26

Browse files
committed
Add a test for image-basename with multiple figures
1 parent 13e5291 commit 20bed26

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

lib/matplotlib/tests/data/tinypages/some_plots.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ Plot 22 uses a different specific function in a file with plot commands:
180180

181181
.. plot:: range6.py range10
182182

183-
Plots 23 and 24 use image-basename.
183+
Plots 23--25 use image-basename.
184184

185185
.. plot::
186186
:image-basename: custom-basename-6
@@ -189,3 +189,12 @@ Plots 23 and 24 use image-basename.
189189

190190
.. plot:: range4.py
191191
:image-basename: custom-basename-4
192+
193+
.. plot::
194+
:image-basename: custom-basename-4-6
195+
196+
plt.figure()
197+
plt.plot(range(4))
198+
199+
plt.figure()
200+
plt.plot(range(6))

lib/matplotlib/tests/test_sphinxext.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,11 @@ def plot_directive_file(num):
9292
assert filecmp.cmp(range_6, plot_file(17))
9393
# plot 22 is from the range6.py file again, but a different function
9494
assert filecmp.cmp(range_10, img_dir / 'range6_range10.png')
95-
# plots 23 and 24 use a custom basename
95+
# plots 23--25 use a custom basename
9696
assert filecmp.cmp(range_6, img_dir / 'custom-basename-6.png')
9797
assert filecmp.cmp(range_4, img_dir / 'custom-basename-4.png')
98+
assert filecmp.cmp(range_4, img_dir / 'custom-basename-4-6_00.png')
99+
assert filecmp.cmp(range_6, img_dir / 'custom-basename-4-6_01.png')
98100

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

0 commit comments

Comments
 (0)