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

Skip to content

Commit 6029e32

Browse files
committed
Updated none patch test
1 parent 3bfca5f commit 6029e32

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4673,7 +4673,13 @@ def test_hist_emptydata():
46734673

46744674

46754675
def test_hist_none_patch():
4676-
plt.hist([1, 2], label=["First", "Second"])
4676+
# To cover None patches when excess labels are provided
4677+
labels = ["First", "Second"]
4678+
patches = [[1, 2]]
4679+
fig, ax = plt.subplots()
4680+
ax.hist(patches, label=labels)
4681+
_, lbls = ax.get_legend_handles_labels()
4682+
assert (len(lbls) < len(labels) and len(patches) < len(labels))
46774683

46784684

46794685
def test_hist_labels():

0 commit comments

Comments
 (0)