Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 34fda3e

Browse filesBrowse files
authored
Merge pull request #8729 from patniharshit/test_fill_between
Parameterize test_fill_between and test_fill_betweenx
2 parents 1774e56 + a0ccb78 commit 34fda3e
Copy full SHA for 34fda3e

File tree

Expand file treeCollapse file tree

1 file changed

+25
-61
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+25
-61
lines changed

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+25-61Lines changed: 25 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -847,40 +847,40 @@ def test_polycollection_joinstyle():
847847
ax.set_ybound(0, 3)
848848

849849

850-
def test_fill_between_2d_x_input():
851-
x = np.zeros((2, 2))
852-
y1 = 3
853-
y2 = 3
854-
855-
fig = plt.figure()
856-
ax = fig.add_subplot(211)
857-
with pytest.raises(ValueError):
858-
ax.plot(x, y1, x, y2, color='black')
859-
ax.fill_between(x, y1, y2)
860-
861-
862-
def test_fill_between_2d_y1_input():
863-
x = np.arange(0.0, 2, 0.02)
864-
y1 = np.zeros((2, 2))
865-
y2 = 3
866-
850+
@pytest.mark.parametrize(
851+
'x, y1, y2', [
852+
(np.zeros((2, 2)), 3, 3),
853+
(np.arange(0.0, 2, 0.02), np.zeros((2, 2)), 3),
854+
(np.arange(0.0, 2, 0.02), 3, np.zeros((2, 2)))
855+
], ids=[
856+
'2d_x_input',
857+
'2d_y1_input',
858+
'2d_y2_input'
859+
]
860+
)
861+
def test_fill_between_input(x, y1, y2):
867862
fig = plt.figure()
868863
ax = fig.add_subplot(211)
869864
with pytest.raises(ValueError):
870-
ax.plot(x, y1, x, y2, color='black')
871865
ax.fill_between(x, y1, y2)
872866

873867

874-
def test_fill_between_2d_y2_input():
875-
x = np.arange(0.0, 2, 0.02)
876-
y1 = 3
877-
y2 = np.zeros((2, 2))
878-
868+
@pytest.mark.parametrize(
869+
'y, x1, x2', [
870+
(np.zeros((2, 2)), 3, 3),
871+
(np.arange(0.0, 2, 0.02), np.zeros((2, 2)), 3),
872+
(np.arange(0.0, 2, 0.02), 3, np.zeros((2, 2)))
873+
], ids=[
874+
'2d_y_input',
875+
'2d_x1_input',
876+
'2d_x2_input'
877+
]
878+
)
879+
def test_fill_betweenx_input(y, x1, x2):
879880
fig = plt.figure()
880881
ax = fig.add_subplot(211)
881882
with pytest.raises(ValueError):
882-
ax.plot(x, y1, x, y2, color='black')
883-
ax.fill_between(x, y1, y2)
883+
ax.fill_betweenx(y, x1, x2)
884884

885885

886886
@image_comparison(baseline_images=['fill_between_interpolate'],
@@ -4995,42 +4995,6 @@ def test_tick_param_label_rotation():
49954995
assert text.get_rotation() == 90
49964996

49974997

4998-
def test_fill_betweenx_2d_y_input():
4999-
y = np.zeros((2, 2))
5000-
x1 = 3
5001-
x2 = 3
5002-
5003-
fig = plt.figure()
5004-
ax = fig.add_subplot(211)
5005-
with pytest.raises(ValueError):
5006-
ax.plot(y, x1, y, x2, color='black')
5007-
ax.fill_betweenx(y, x1, x2)
5008-
5009-
5010-
def test_fill_betweenx_2d_x1_input():
5011-
y = np.arange(0.0, 2, 0.02)
5012-
x1 = np.zeros((2, 2))
5013-
x2 = 3
5014-
5015-
fig = plt.figure()
5016-
ax = fig.add_subplot(211)
5017-
with pytest.raises(ValueError):
5018-
ax.plot(y, x1, y, x2, color='black')
5019-
ax.fill_betweenx(y, x1, x2)
5020-
5021-
5022-
def test_fill_betweenx_2d_x2_input():
5023-
y = np.arange(0.0, 2, 0.02)
5024-
x1 = 3
5025-
x2 = np.zeros((2, 2))
5026-
5027-
fig = plt.figure()
5028-
ax = fig.add_subplot(211)
5029-
with pytest.raises(ValueError):
5030-
ax.plot(y, x1, y, x2, color='black')
5031-
ax.fill_betweenx(y, x1, x2)
5032-
5033-
50344998
@pytest.mark.style('default')
50354999
def test_fillbetween_cycle():
50365000
fig, ax = plt.subplots()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.