diff --git a/lib/mpl_toolkits/mplot3d/art3d.py b/lib/mpl_toolkits/mplot3d/art3d.py index b0e27a30618c..5df5c8271e7f 100644 --- a/lib/mpl_toolkits/mplot3d/art3d.py +++ b/lib/mpl_toolkits/mplot3d/art3d.py @@ -880,7 +880,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.") diff --git a/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py b/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py index a618ee7a803d..e4c2053dc072 100644 --- a/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py +++ b/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py @@ -2176,3 +2176,13 @@ def test_mutating_input_arrays_y_and_z(fig_test, fig_ref): y = [0.0, 0.0, 0.0] z = [0.0, 0.0, 0.0] ax2.plot(x, y, z, 'o-') + + +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)