Thanks to visit codestin.com
Credit goes to github.com

Skip to content

better input validation on fill_between #7817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 18, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change tests to use pytest.raises() instead of @raises
  • Loading branch information
samsontmr committed Jan 14, 2017
commit 72f6359c0596faba56dd7809b2ae6573c4d705b0
24 changes: 12 additions & 12 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,6 @@ def test_polycollection_joinstyle():
ax.set_ybound(0, 3)


@raises(ValueError)
def test_fill_between_2d_x_input():
x = np.zeros((2, 2))
y1 = 3
Expand All @@ -734,10 +733,10 @@ def test_fill_between_2d_x_input():
fig = plt.figure()
ax = fig.add_subplot(211)
ax.plot(x, y1, x, y2, color='black')
ax.fill_between(x, y1, y2)
with pytest.raises(ValueError):
ax.fill_between(x, y1, y2)


@raises(ValueError)
def test_fill_between_2d_y1_input():
x = np.arange(0.0, 2, 0.02)
y1 = np.zeros((2, 2))
Expand All @@ -746,10 +745,10 @@ def test_fill_between_2d_y1_input():
fig = plt.figure()
ax = fig.add_subplot(211)
ax.plot(x, y1, x, y2, color='black')
ax.fill_between(x, y1, y2)
with pytest.raises(ValueError):
ax.fill_between(x, y1, y2)


@raises(ValueError)
def test_fill_between_2d_y2_input():
x = np.arange(0.0, 2, 0.02)
y1 = 3
Expand All @@ -758,7 +757,8 @@ def test_fill_between_2d_y2_input():
fig = plt.figure()
ax = fig.add_subplot(211)
ax.plot(x, y1, x, y2, color='black')
ax.fill_between(x, y1, y2)
with pytest.raises(ValueError):
ax.fill_between(x, y1, y2)


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


@raises(ValueError)
def test_fill_betweenx_2d_y_input():
y = np.zeros((2, 2))
x1 = 3
Expand All @@ -4846,10 +4845,10 @@ def test_fill_betweenx_2d_y_input():
fig = plt.figure()
ax = fig.add_subplot(211)
ax.plot(y, x1, y, x2, color='black')
ax.fill_betweenx(y, x1, x2)
with pytest.raises(ValueError):
ax.fill_betweenx(y, x1, x2)


@raises(ValueError)
def test_fill_betweenx_2d_x1_input():
y = np.arange(0.0, 2, 0.02)
x1 = np.zeros((2, 2))
Expand All @@ -4858,10 +4857,10 @@ def test_fill_betweenx_2d_x1_input():
fig = plt.figure()
ax = fig.add_subplot(211)
ax.plot(y, x1, y, x2, color='black')
ax.fill_betweenx(y, x1, x2)
with pytest.raises(ValueError):
ax.fill_betweenx(y, x1, x2)


@raises(ValueError)
def test_fill_betweenx_2d_x2_input():
y = np.arange(0.0, 2, 0.02)
x1 = 3
Expand All @@ -4870,7 +4869,8 @@ def test_fill_betweenx_2d_x2_input():
fig = plt.figure()
ax = fig.add_subplot(211)
ax.plot(y, x1, y, x2, color='black')
ax.fill_betweenx(y, x1, x2)
with pytest.raises(ValueError):
ax.fill_betweenx(y, x1, x2)


@cleanup(style='default')
Expand Down