Skip to content

Commit a2caf5e

Browse files
committed
Add test to test_axes3d.py
Add a test for view_init()'s positional args case
1 parent 2bda819 commit a2caf5e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/mpl_toolkits/mplot3d/tests/test_axes3d.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2417,6 +2417,22 @@ def test_view_init_vertical_axis(
24172417
np.testing.assert_array_equal(tickdir_expected, tickdir_actual)
24182418

24192419

2420+
def test_view_init_positional_args():
2421+
"""
2422+
Test view_init() with positional instead of keyword arguments
2423+
"""
2424+
ax = plt.subplot(1, 1, 1, projection="3d")
2425+
with pytest.deprecated_call():
2426+
ax.view_init(10, 20, 30, "y", False)
2427+
assert ax.azim == 20
2428+
assert ax.elev == 10
2429+
assert ax.roll == 30
2430+
assert ax._vertical_axis == 1
2431+
2432+
with pytest.raises(TypeError):
2433+
ax.view_init(10, 20, 30, "y", False, "superfluous argument")
2434+
2435+
24202436
@pytest.mark.parametrize("vertical_axis", ["x", "y", "z"])
24212437
def test_on_move_vertical_axis(vertical_axis: str) -> None:
24222438
"""

0 commit comments

Comments
 (0)