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 eb51274

Browse filesBrowse files
committed
TST: Use text placeholders for empty legends
These tests use `remove_text=True` and set legend labels to empty strings. However, they are still affected by font metrics because even the empty string is as tall as the line height (which is calculated from the height of the "lp" string.)
1 parent 1840d9b commit eb51274
Copy full SHA for eb51274

File tree

12 files changed

+320
-342
lines changed
Filter options

12 files changed

+320
-342
lines changed
Loading
Binary file not shown.
Binary file not shown.
Loading

‎lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight.svg

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/baseline_images/test_bbox_tight/bbox_inches_tight.svg
+312-333Lines changed: 312 additions & 333 deletions
Loading
Loading
Loading

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4593,7 +4593,7 @@ def test_hist_stacked_weighted():
45934593

45944594

45954595
@image_comparison(['stem.png'], style='mpl20', remove_text=True)
4596-
def test_stem():
4596+
def test_stem(text_placeholders):
45974597
x = np.linspace(0.1, 2 * np.pi, 100)
45984598

45994599
fig, ax = plt.subplots()

‎lib/matplotlib/tests/test_backend_pdf.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backend_pdf.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ def test_pdfpages_fspath():
296296
pdf.savefig(plt.figure())
297297

298298

299-
@image_comparison(['hatching_legend.pdf'])
300-
def test_hatching_legend():
299+
@image_comparison(['hatching_legend.pdf'], style='mpl20')
300+
def test_hatching_legend(text_placeholders):
301301
"""Test for correct hatching on patches in legend"""
302302
fig = plt.figure(figsize=(1, 2))
303303

‎lib/matplotlib/tests/test_bbox_tight.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_bbox_tight.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
1212

1313

14-
@image_comparison(['bbox_inches_tight'], remove_text=True,
14+
@image_comparison(['bbox_inches_tight'], remove_text=True, style='mpl20',
1515
savefig_kwarg={'bbox_inches': 'tight'})
16-
def test_bbox_inches_tight():
16+
def test_bbox_inches_tight(text_placeholders):
1717
#: Test that a figure saved using bbox_inches='tight' is clipped correctly
1818
data = [[66386, 174296, 75131, 577908, 32015],
1919
[58230, 381139, 78045, 99308, 160454],

‎lib/matplotlib/tests/test_lines.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_lines.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ def test_marker_as_markerstyle():
332332

333333

334334
@image_comparison(['striped_line.png'], remove_text=True, style='mpl20')
335-
def test_striped_lines():
335+
def test_striped_lines(text_placeholders):
336336
rng = np.random.default_rng(19680801)
337337
_, ax = plt.subplots()
338338
ax.plot(rng.uniform(size=12), color='orange', gapcolor='blue',

‎lib/matplotlib/tests/test_patheffects.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_patheffects.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,8 @@ def test_collection():
135135
'edgecolor': 'blue'})
136136

137137

138-
@image_comparison(['tickedstroke'], remove_text=True, extensions=['png'],
139-
tol=0.22) # Increased tolerance due to fixed clipping.
140-
def test_tickedstroke():
138+
@image_comparison(['tickedstroke.png'], remove_text=True, style='mpl20')
139+
def test_tickedstroke(text_placeholders):
141140
fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(12, 4))
142141
path = Path.unit_circle()
143142
patch = patches.PathPatch(path, facecolor='none', lw=2, path_effects=[

0 commit comments

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