Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bb337ad

Browse files
authored
Merge pull request #10725 from jklymak/fix-tst-constrainedlayout-badtest
FIX/TST constrained_layout remove test8 duplication
2 parents 0a8a7db + 3d6f2ae commit bb337ad

File tree

1 file changed

+14
-54
lines changed

1 file changed

+14
-54
lines changed

lib/matplotlib/tests/test_constrainedlayout.py

Lines changed: 14 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -123,40 +123,6 @@ def test_constrained_layout6():
123123
ticks=ticker.MaxNLocator(nbins=5))
124124

125125

126-
@image_comparison(baseline_images=['constrained_layout8'],
127-
extensions=['png'])
128-
def test_constrained_layout8():
129-
'Test for gridspecs that are not completely full'
130-
fig = plt.figure(figsize=(7, 4), constrained_layout=True)
131-
gs = gridspec.GridSpec(3, 5, figure=fig)
132-
axs = []
133-
j = 1
134-
for i in [0, 1]:
135-
ax = fig.add_subplot(gs[j, i])
136-
axs += [ax]
137-
pcm = example_pcolor(ax, fontsize=10)
138-
if i > 0:
139-
ax.set_ylabel('')
140-
if j < 1:
141-
ax.set_xlabel('')
142-
ax.set_title('')
143-
j = 0
144-
for i in [2, 4]:
145-
ax = fig.add_subplot(gs[j, i])
146-
axs += [ax]
147-
pcm = example_pcolor(ax, fontsize=10)
148-
if i > 0:
149-
ax.set_ylabel('')
150-
if j < 1:
151-
ax.set_xlabel('')
152-
ax.set_title('')
153-
ax = fig.add_subplot(gs[2, :])
154-
axs += [ax]
155-
pcm = example_pcolor(ax, fontsize=10)
156-
157-
fig.colorbar(pcm, ax=axs, pad=0.01, shrink=0.6)
158-
159-
160126
def test_constrained_layout7():
161127
'Test for proper warning if fig not set in GridSpec'
162128
with pytest.warns(UserWarning, match='Calling figure.constrained_layout, '
@@ -179,26 +145,20 @@ def test_constrained_layout8():
179145
fig = plt.figure(figsize=(10, 5), constrained_layout=True)
180146
gs = gridspec.GridSpec(3, 5, figure=fig)
181147
axs = []
182-
j = 1
183-
for i in [0, 4]:
184-
ax = fig.add_subplot(gs[j, i])
185-
axs += [ax]
186-
pcm = example_pcolor(ax, fontsize=9)
187-
if i > 0:
188-
ax.set_ylabel('')
189-
if j < 1:
190-
ax.set_xlabel('')
191-
ax.set_title('')
192-
j = 0
193-
for i in [1]:
194-
ax = fig.add_subplot(gs[j, i])
195-
axs += [ax]
196-
pcm = example_pcolor(ax, fontsize=9)
197-
if i > 0:
198-
ax.set_ylabel('')
199-
if j < 1:
200-
ax.set_xlabel('')
201-
ax.set_title('')
148+
for j in [0, 1]:
149+
if j == 0:
150+
ilist = [1]
151+
else:
152+
ilist = [0, 4]
153+
for i in ilist:
154+
ax = fig.add_subplot(gs[j, i])
155+
axs += [ax]
156+
pcm = example_pcolor(ax, fontsize=9)
157+
if i > 0:
158+
ax.set_ylabel('')
159+
if j < 1:
160+
ax.set_xlabel('')
161+
ax.set_title('')
202162
ax = fig.add_subplot(gs[2, :])
203163
axs += [ax]
204164
pcm = example_pcolor(ax, fontsize=9)

0 commit comments

Comments
 (0)