Skip to content

Commit 72f6359

Browse files
committed
Change tests to use pytest.raises() instead of @raises
1 parent c353bce commit 72f6359

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,6 @@ def test_polycollection_joinstyle():
725725
ax.set_ybound(0, 3)
726726

727727

728-
@raises(ValueError)
729728
def test_fill_between_2d_x_input():
730729
x = np.zeros((2, 2))
731730
y1 = 3
@@ -734,10 +733,10 @@ def test_fill_between_2d_x_input():
734733
fig = plt.figure()
735734
ax = fig.add_subplot(211)
736735
ax.plot(x, y1, x, y2, color='black')
737-
ax.fill_between(x, y1, y2)
736+
with pytest.raises(ValueError):
737+
ax.fill_between(x, y1, y2)
738738

739739

740-
@raises(ValueError)
741740
def test_fill_between_2d_y1_input():
742741
x = np.arange(0.0, 2, 0.02)
743742
y1 = np.zeros((2, 2))
@@ -746,10 +745,10 @@ def test_fill_between_2d_y1_input():
746745
fig = plt.figure()
747746
ax = fig.add_subplot(211)
748747
ax.plot(x, y1, x, y2, color='black')
749-
ax.fill_between(x, y1, y2)
748+
with pytest.raises(ValueError):
749+
ax.fill_between(x, y1, y2)
750750

751751

752-
@raises(ValueError)
753752
def test_fill_between_2d_y2_input():
754753
x = np.arange(0.0, 2, 0.02)
755754
y1 = 3
@@ -758,7 +757,8 @@ def test_fill_between_2d_y2_input():
758757
fig = plt.figure()
759758
ax = fig.add_subplot(211)
760759
ax.plot(x, y1, x, y2, color='black')
761-
ax.fill_between(x, y1, y2)
760+
with pytest.raises(ValueError):
761+
ax.fill_between(x, y1, y2)
762762

763763

764764
@image_comparison(baseline_images=['fill_between_interpolate'],
@@ -4837,7 +4837,6 @@ def test_tick_param_label_rotation():
48374837
assert text.get_rotation() == 90
48384838

48394839

4840-
@raises(ValueError)
48414840
def test_fill_betweenx_2d_y_input():
48424841
y = np.zeros((2, 2))
48434842
x1 = 3
@@ -4846,10 +4845,10 @@ def test_fill_betweenx_2d_y_input():
48464845
fig = plt.figure()
48474846
ax = fig.add_subplot(211)
48484847
ax.plot(y, x1, y, x2, color='black')
4849-
ax.fill_betweenx(y, x1, x2)
4848+
with pytest.raises(ValueError):
4849+
ax.fill_betweenx(y, x1, x2)
48504850

48514851

4852-
@raises(ValueError)
48534852
def test_fill_betweenx_2d_x1_input():
48544853
y = np.arange(0.0, 2, 0.02)
48554854
x1 = np.zeros((2, 2))
@@ -4858,10 +4857,10 @@ def test_fill_betweenx_2d_x1_input():
48584857
fig = plt.figure()
48594858
ax = fig.add_subplot(211)
48604859
ax.plot(y, x1, y, x2, color='black')
4861-
ax.fill_betweenx(y, x1, x2)
4860+
with pytest.raises(ValueError):
4861+
ax.fill_betweenx(y, x1, x2)
48624862

48634863

4864-
@raises(ValueError)
48654864
def test_fill_betweenx_2d_x2_input():
48664865
y = np.arange(0.0, 2, 0.02)
48674866
x1 = 3
@@ -4870,7 +4869,8 @@ def test_fill_betweenx_2d_x2_input():
48704869
fig = plt.figure()
48714870
ax = fig.add_subplot(211)
48724871
ax.plot(y, x1, y, x2, color='black')
4873-
ax.fill_betweenx(y, x1, x2)
4872+
with pytest.raises(ValueError):
4873+
ax.fill_betweenx(y, x1, x2)
48744874

48754875

48764876
@cleanup(style='default')

0 commit comments

Comments
 (0)