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

Skip to content

Commit 4003858

Browse files
committed
TST: Verify all the call signatures work correctly
1 parent 0a2f069 commit 4003858

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,32 @@ def midpoints(x):
692692
edgecolors=np.clip(2*colors - 0.5, 0, 1), # brighter
693693
linewidth=0.5)
694694

695+
def test_calling_conventions(self):
696+
x, y, z = np.indices((3, 4, 5))
697+
filled = np.ones((2, 3, 4))
698+
699+
fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
700+
701+
# all the valid calling conventions
702+
for kw in (dict(), dict(edgecolor='k')):
703+
ax.voxels(filled, **kw)
704+
ax.voxels(filled=filled, **kw)
705+
ax.voxels(x, y, z, filled, **kw)
706+
ax.voxels(x, y, z, filled=filled, **kw)
707+
708+
# duplicate argument
709+
with pytest.raises(TypeError) as exc:
710+
ax.voxels(x, y, z, filled, filled=filled)
711+
exc.match(".*voxels.*")
712+
# missing arguments
713+
with pytest.raises(TypeError) as exc:
714+
ax.voxels(x, y)
715+
exc.match(".*voxels.*")
716+
# x,y,z are positional only - this passes them on as attributes of
717+
# Poly3DCollection
718+
with pytest.raises(AttributeError):
719+
ax.voxels(filled=filled, x=x, y=y, z=z)
720+
695721

696722
def test_inverted_cla():
697723
# Github PR #5450. Setting autoscale should reset

0 commit comments

Comments
 (0)