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

Skip to content

Commit 3496ba2

Browse files
committed
add test_xer_yerr_positive
1 parent ec1da3b commit 3496ba2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3513,6 +3513,18 @@ def test_errorbar_every_invalid():
35133513
ax.errorbar(x, y, yerr, errorevery='foobar')
35143514

35153515

3516+
def test_xerr_yerr_positive():
3517+
ax = plt.figure().subplots()
3518+
3519+
with pytest.raises(ValueError,
3520+
match="'xerr' and 'yerr' must have positive numbers"):
3521+
ax.errorbar(x=[0], y=[0], xerr=[[-0.5], [1]], yerr=[[-0.5], [1]])
3522+
with pytest.raises(ValueError, match="'xerr' must have positive numbers"):
3523+
ax.errorbar(x=[0], y=[0], xerr=[[-0.5], [1]])
3524+
with pytest.raises(ValueError, match="'yerr' must have positive numbers"):
3525+
ax.errorbar(x=[0], y=[0], yerr=[[-0.5], [1]])
3526+
3527+
35163528
@check_figures_equal()
35173529
def test_errorbar_every(fig_test, fig_ref):
35183530
x = np.linspace(0, 1, 15)

0 commit comments

Comments
 (0)