8000 Make an error · matplotlib/matplotlib@67117cc · GitHub
[go: up one dir, main page]

Skip to content

Commit 67117cc

Browse files
committed
Make an error
1 parent beeaae9 commit 67117cc

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

lib/matplotlib/pyplot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -956,8 +956,8 @@ def subplot(*args, **kwargs):
956956
"subplots()?")
957957
# Check for nrows and ncols, which are not valid subplot args:
958958
if 'nrows' in kwargs or 'ncols' in kwargs:
959-
cbook._warn_external("You have passed nrows and/or ncols to "
960-
"subplot(). Did you mean to use subplots()?")
959+
raise TypeError("subplot() got an unexpected keyword argument 'ncols' "
960+
"and/or 'nrows'. Did you intend to call subplots()?")
961961

962962
fig = gcf()
963963
a = fig.add_subplot(*args, **kwargs)

lib/matplotlib/tests/test_pyplot.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,8 @@ def test_stackplot_smoke():
5353
plt.stackplot([1, 2, 3], [1, 2, 3])
5454

5555

56-
def test_nrows_warn():
57-
with pytest.raises(AttributeError):
58-
with pytest.warns(UserWarning) as rec:
59-
plt.subplot(nrows=1)
60-
with pytest.raises(AttributeError):
61-
with pytest.warns(UserWarning) as rec:
62-
plt.subplot(ncols=1)
56+
def test_nrows_error():
57+
with pytest.raises(TypeError):
58+
plt.subplot(nrows=1)
59+
with pytest.raises(TypeError):
60+
plt.subplot(ncols=1)

0 commit comments

Comments
 (0)
0