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

Skip to content

Commit 6686674

Browse files
fix input check in Poly3DCollection.__init__
1 parent 0849036 commit 6686674

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/mpl_toolkits/mplot3d/art3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ def __init__(self, verts, *args, zsort='average', shade=False,
905905
kwargs['edgecolors'] = _shade_colors(
906906
edgecolors, normals, lightsource
907907
)
908-
if facecolors is None and edgecolors in None:
908+
if facecolors is None and edgecolors is None:
909909
raise ValueError(
910910
"You must provide facecolors, edgecolors, or both for "
911911
"shade to work.")

lib/mpl_toolkits/mplot3d/tests/test_axes3d.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2260,3 +2260,13 @@ def test_surface3d_zsort_inf():
22602260

22612261
ax.plot_surface(x, y, z, cmap='jet')
22622262
ax.view_init(elev=45, azim=145)
2263+
2264+
2265+
def test_Poly3DCollection_init_value_error():
2266+
# smoke test to ensure the input check works
2267+
# GH#26420
2268+
with pytest.raises(ValueError,
2269+
match='You must provide facecolors, edgecolors, '
2270+
'or both for shade to work.'):
2271+
poly = np.array([[0, 0, 1], [0, 1, 1], [0, 0, 0]], float)
2272+
c = art3d.Poly3DCollection([poly], shade=True)

0 commit comments

Comments
 (0)