Skip to content

Commit 875dbf0

Browse files
committed
Move test that fig.add_axes() needs parameters
For historic reasons, this test was in `test_gca()`: Originally the test test tested that `gca()` picks up the Axes created by `add_axes()`. But that behavior was deprecated and the test turned into a check that is doesn't work anymore. The test is now better placed in `test_invalid_figure_add_axes()`.
1 parent 037fcca commit 875dbf0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/matplotlib/tests/test_figure.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,6 @@ def test_figure_legend():
189189
def test_gca():
190190
fig = plt.figure()
191191

192-
with pytest.raises(TypeError):
193-
assert fig.add_axes() is None
194-
195192
ax0 = fig.add_axes([0, 0, 1, 1])
196193
with pytest.warns(
197194
MatplotlibDeprecationWarning,
@@ -476,6 +473,10 @@ def test_invalid_figure_size(width, height):
476473

477474
def test_invalid_figure_add_axes():
478475
fig = plt.figure()
476+
with pytest.raises(TypeError,
477+
match="missing 1 required positional argument: 'rect'"):
478+
fig.add_axes()
479+
479480
with pytest.raises(ValueError):
480481
fig.add_axes((.1, .1, .5, np.nan))
481482

0 commit comments

Comments
 (0)