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

Skip to content

Backport PR #26532 on branch v3.8.x (Fix input check in Poly3DCollection.__init__) #26536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/mpl_toolkits/mplot3d/art3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ def __init__(self, verts, *args, zsort='average', shade=False,
kwargs['edgecolors'] = _shade_colors(
edgecolors, normals, lightsource
)
if facecolors is None and edgecolors in None:
if facecolors is None and edgecolors is None:
raise ValueError(
"You must provide facecolors, edgecolors, or both for "
"shade to work.")
Expand Down
10 changes: 10 additions & 0 deletions lib/mpl_toolkits/mplot3d/tests/test_axes3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -2260,3 +2260,13 @@ def test_surface3d_zsort_inf():

ax.plot_surface(x, y, z, cmap='jet')
ax.view_init(elev=45, azim=145)


def test_Poly3DCollection_init_value_error():
# smoke test to ensure the input check works
# GH#26420
with pytest.raises(ValueError,
match='You must provide facecolors, edgecolors, '
'or both for shade to work.'):
poly = np.array([[0, 0, 1], [0, 1, 1], [0, 0, 0]], float)
c = art3d.Poly3DCollection([poly], shade=True)