Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit37e5518

Browse files
committed
TST: Fix tight layout tests without text
If we pass `remove_text` to `image_comparison`, we don't expect tests tochange from FreeType. But if `tight_layout` is called *before* the endof the test function, the layout will happen with the text that wassupposed to be removed.
1 parent60c293f commit37e5518

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-
deftest_diff_cell_table():
90+
@image_comparison(['table_cell_manipulation.png'])
91+
deftest_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
forax,cellinzip(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
deftest_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
deftest_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
fordirectionin ("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
deftest_subplotzero_ylabel():

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp