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

Skip to content

Commit 73985d9

Browse files
authored
Merge pull request #26544 from QuLogic/auto-backport-of-pr-26532-on-v3.7.x
Backport PR #26532: Fix input check in Poly3DCollection.__init__
2 parents 2679b8e + 4a1ef78 commit 73985d9

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
@@ -880,7 +880,7 @@ def __init__(self, verts, *args, zsort='average', shade=False,
880880
kwargs['edgecolors'] = _shade_colors(
881881
edgecolors, normals, lightsource
882882
)
883-
if facecolors is None and edgecolors in None:
883+
if facecolors is None and edgecolors is None:
884884
raise ValueError(
885885
"You must provide facecolors, edgecolors, or both for "
886886
"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
@@ -2176,3 +2176,13 @@ def test_mutating_input_arrays_y_and_z(fig_test, fig_ref):
21762176
y = [0.0, 0.0, 0.0]
21772177
z = [0.0, 0.0, 0.0]
21782178
ax2.plot(x, y, z, 'o-')
2179+
2180+
2181+
def test_Poly3DCollection_init_value_error():
2182+
# smoke test to ensure the input check works
2183+
# GH#26420
2184+
with pytest.raises(ValueError,
2185+
match='You must provide facecolors, edgecolors, '
2186+
'or both for shade to work.'):
2187+
poly = np.array([[0, 0, 1], [0, 1, 1], [0, 0, 0]], float)
2188+
c = art3d.Poly3DCollection([poly], shade=True)

0 commit comments

Comments
 (0)