Skip to content

Commit f1d5d26

Browse files
committed
Update exception string to use %r for formatting
1 parent 72f6359 commit f1d5d26

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4777,8 +4777,8 @@ def fill_between(self, x, y1, y2=0, where=None, interpolate=False,
47774777

47784778
for name, array in [('x', x), ('y1', y1), ('y2', y2)]:
47794779
if array.ndim > 1:
4780-
raise ValueError('Input passed into argument "' + name +
4781-
'" is not 1-dimensional.')
4780+
raise ValueError('Input passed into argument "%r"' % name +
4781+
'is not 1-dimensional.')
47824782

47834783
if y1.ndim == 0:
47844784
y1 = np.ones_like(x) * y1
@@ -4941,10 +4941,10 @@ def fill_betweenx(self, y, x1, x2=0, where=None,
49414941
x1 = ma.masked_invalid(self.convert_xunits(x1))
49424942
x2 = ma.masked_invalid(self.convert_xunits(x2))
49434943

4944-
for array in [('x', x), ('y1', y1), ('y2', y2)]:
4945-
if array[1].ndim > 1:
4946-
raise ValueError('Input passed into argument "' + array[0] +
4947-
'" is not 1-dimensional.')
4944+
for name, array in [('y', y), ('x1', x1), ('x2', x2)]:
4945+
if array.ndim > 1:
4946+
raise ValueError('Input passed into argument "%r"' % name +
4947+
'is not 1-dimensional.')
49484948

49494949
if x1.ndim == 0:
49504950
x1 = np.ones_like(y) * x1

lib/matplotlib/tests/test_axes.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -732,8 +732,8 @@ def test_fill_between_2d_x_input():
732732

733733
fig = plt.figure()
734734
ax = fig.add_subplot(211)
735-
ax.plot(x, y1, x, y2, color='black')
736735
with pytest.raises(ValueError):
736+
ax.plot(x, y1, x, y2, color='black')
737737
ax.fill_between(x, y1, y2)
738738

739739

@@ -744,8 +744,8 @@ def test_fill_between_2d_y1_input():
744744

745745
fig = plt.figure()
746746
ax = fig.add_subplot(211)
747-
ax.plot(x, y1, x, y2, color='black')
748747
with pytest.raises(ValueError):
748+
ax.plot(x, y1, x, y2, color='black')
749749
ax.fill_between(x, y1, y2)
750750

751751

@@ -756,8 +756,8 @@ def test_fill_between_2d_y2_input():
756756

757757
fig = plt.figure()
758758
ax = fig.add_subplot(211)
759-
ax.plot(x, y1, x, y2, color='black')
760759
with pytest.raises(ValueError):
760+
ax.plot(x, y1, x, y2, color='black')
761761
ax.fill_between(x, y1, y2)
762762

763763

@@ -4844,8 +4844,8 @@ def test_fill_betweenx_2d_y_input():
48444844

48454845
fig = plt.figure()
48464846
ax = fig.add_subplot(211)
4847-
ax.plot(y, x1, y, x2, color='black')
48484847
with pytest.raises(ValueError):
4848+
ax.plot(y, x1, y, x2, color='black')
48494849
ax.fill_betweenx(y, x1, x2)
48504850

48514851

@@ -4856,8 +4856,8 @@ def test_fill_betweenx_2d_x1_input():
48564856

48574857
fig = plt.figure()
48584858
ax = fig.add_subplot(211)
4859-
ax.plot(y, x1, y, x2, color='black')
48604859
with pytest.raises(ValueError):
4860+
ax.plot(y, x1, y, x2, color='black')
48614861
ax.fill_betweenx(y, x1, x2)
48624862

48634863

@@ -4868,8 +4868,8 @@ def test_fill_betweenx_2d_x2_input():
48684868

48694869
fig = plt.figure()
48704870
ax = fig.add_subplot(211)
4871-
ax.plot(y, x1, y, x2, color='black')
48724871
with pytest.raises(ValueError):
4872+
ax.plot(y, x1, y, x2, color='black')
48734873
ax.fill_betweenx(y, x1, x2)
48744874

48754875

0 commit comments

Comments
 (0)