Skip to content

Commit 5c48037

Browse files
committed
Add unit tests
1 parent ec6014f commit 5c48037

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

lib/matplotlib/tests/test_axes.py

+21
Original file line numberDiff line numberDiff line change
@@ -6149,6 +6149,27 @@ def test_pie_get_negative_values():
61496149
ax.pie([5, 5, -3], explode=[0, .1, .2])
61506150

61516151

6152+
def test_pie_invalid_explode():
6153+
# Test ValueError raised when feeding short explode list to axes.pie
6154+
fig, ax = plt.subplots()
6155+
with pytest.raises(ValueError):
6156+
ax.pie([1, 2, 3], explode=[0.1, 0.1])
6157+
6158+
6159+
def test_pie_invalid_labels():
6160+
# Test ValueError raised when feeding short labels list to axes.pie
6161+
fig, ax = plt.subplots()
6162+
with pytest.raises(ValueError):
6163+
ax.pie([1, 2, 3], labels=["One", "Two"])
6164+
6165+
6166+
def test_pie_invalid_radius():
6167+
# Test ValueError raised when feeding negative radius to axes.pie
6168+
fig, ax = plt.subplots()
6169+
with pytest.raises(ValueError):
6170+
ax.pie([1, 2, 3], radius=-5)
6171+
6172+
61526173
def test_normalize_kwarg_pie():
61536174
fig, ax = plt.subplots()
61546175
x = [0.3, 0.3, 0.1]

0 commit comments

Comments
 (0)