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

Skip to content

Commit 2e854aa

Browse files
committed
Remove duplicate test and parametrize test
1 parent 2b3db00 commit 2e854aa

File tree

1 file changed

+5
-24
lines changed

1 file changed

+5
-24
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2786,35 +2786,16 @@ def test_hist_stacked_density():
27862786
ax.hist((d1, d2), stacked=True, density=True)
27872787

27882788

2789-
def test_hist_normed_density():
2789+
@pytest.mark.parametrize('normed', [False, True])
2790+
@pytest.mark.parametrize('density', [False, True])
2791+
def test_hist_normed_density(normed, density):
27902792
# Normed and density should not be used simultaneously
27912793
d1 = np.linspace(1, 3, 20)
27922794
d2 = np.linspace(0, 10, 50)
2793-
fig = plt.figure()
2794-
ax = fig.add_subplot(111)
2795+
fig, ax = plt.subplots()
27952796
# test that kwargs normed and density cannot be set both.
27962797
with pytest.raises(Exception):
2797-
ax.hist((d1, d2), stacked=True, normed=True, density=True)
2798-
2799-
with pytest.raises(Exception):
2800-
ax.hist((d1, d2), stacked=True, normed=False, density=True)
2801-
2802-
with pytest.raises(Exception):
2803-
ax.hist((d1, d2), stacked=True, normed=False, density=False)
2804-
2805-
with pytest.raises(Exception):
2806-
ax.hist((d1, d2), stacked=True, normed=True, density=False)
2807-
2808-
2809-
def test_hist_stacked_density():
2810-
# make some data
2811-
d1 = np.linspace(1, 3, 20)
2812-
d2 = np.linspace(0, 10, 50)
2813-
fig, ax = plt.subplots()
2814-
ax.hist((d1, d2), stacked=True, density=True)
2815-
2816-
with pytest.raises(ValueError):
2817-
ax.hist((d1, d2), stacked=True, density=True, normed=False)
2798+
ax.hist((d1, d2), stacked=True, normed=normed, density=density)
28182799

28192800

28202801
@image_comparison(baseline_images=['hist_step_bottom'], extensions=['png'],

0 commit comments

Comments
 (0)