Skip to content

Commit 3031da0

Browse files
committed
TST: add a test for tight_layout warning
1 parent 18d0f9a commit 3031da0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/matplotlib/tests/test_tightlayout.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,3 +305,14 @@ def test_big_decorators_vertical():
305305
with warnings.catch_warnings(record=True) as w:
306306
fig.tight_layout()
307307
assert len(w) == 1
308+
309+
310+
def test_badsubplotgrid():
311+
# test that we get warning for mismatched subplot grids rather
312+
# than an error
313+
ax1 = plt.subplot2grid((4, 5), (0, 0))
314+
# this is the bad entry:
315+
ax5 = plt.subplot2grid((5, 5), (0, 3), colspan=3, rowspan=5)
316+
with warnings.catch_warnings(record=True) as w:
317+
plt.tight_layout()
318+
assert len(w) == 1

0 commit comments

Comments
 (0)