Skip to content

Commit 37e5518

Browse files
committed
TST: Fix tight layout tests without text
If we pass `remove_text` to `image_comparison`, we don't expect tests to change from FreeType. But if `tight_layout` is called *before* the end of the test function, the layout will happen with the text that was supposed to be removed.
1 parent 60c293f commit 37e5518

File tree

4 files changed

+4
-7
lines changed

4 files changed

+4
-7
lines changed

lib/matplotlib/tests/test_table.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ def test_label_colours():
8787
loc='best')
8888

8989

90-
@image_comparison(['table_cell_manipulation.png'], remove_text=True)
91-
def test_diff_cell_table():
90+
@image_comparison(['table_cell_manipulation.png'])
91+
def test_diff_cell_table(_text_placeholders):
9292
cells = ('horizontal', 'vertical', 'open', 'closed', 'T', 'R', 'B', 'L')
9393
cellText = [['1'] * len(cells)] * 2
9494
colWidths = [0.1] * len(cells)
9595

96-
_, axs = plt.subplots(nrows=len(cells), figsize=(4, len(cells)+1))
96+
_, axs = plt.subplots(nrows=len(cells), figsize=(4, len(cells)+1), layout='tight')
9797
for ax, cell in zip(axs, cells):
9898
ax.table(
9999
colWidths=colWidths,
@@ -102,7 +102,6 @@ def test_diff_cell_table():
102102
edges=cell,
103103
)
104104
ax.axis('off')
105-
plt.tight_layout()
106105

107106

108107
def test_customcell():

lib/mpl_toolkits/axisartist/tests/test_axislines.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def test_axisline_style_size_color():
119119
@image_comparison(['axisline_style_tight.png'], remove_text=True,
120120
style='mpl20')
121121
def test_axisline_style_tight():
122-
fig = plt.figure(figsize=(2, 2))
122+
fig = plt.figure(figsize=(2, 2), layout='tight')
123123
ax = fig.add_subplot(axes_class=AxesZero)
124124
ax.axis["xzero"].set_axisline_style("-|>", size=5, facecolor='g')
125125
ax.axis["xzero"].set_visible(True)
@@ -129,8 +129,6 @@ def test_axisline_style_tight():
129129
for direction in ("left", "right", "bottom", "top"):
130130
ax.axis[direction].set_visible(False)
131131

132-
fig.tight_layout()
133-
134132

135133
@image_comparison(['subplotzero_ylabel.png'], style='mpl20')
136134
def test_subplotzero_ylabel():

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy