Skip to content

Commit f630c28

Browse files
authored
Merge pull request #24511 from saranti/test
Add test for mutating input arrays #8990
2 parents fb5c7c5 + a30a64e commit f630c28

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

lib/mpl_toolkits/mplot3d/tests/test_axes3d.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,3 +2124,29 @@ def test_panecolor_rcparams():
21242124
'axes3d.zaxis.panecolor': 'b'}):
21252125
fig = plt.figure(figsize=(1, 1))
21262126
fig.add_subplot(projection='3d')
2127+
2128+
2129+
@check_figures_equal(extensions=["png"])
2130+
def test_mutating_input_arrays_y_and_z(fig_test, fig_ref):
2131+
"""
2132+
Test to see if the `z` axis does not get mutated
2133+
after a call to `Axes3D.plot`
2134+
2135+
test cases came from GH#8990
2136+
"""
2137+
ax1 = fig_test.add_subplot(111, projection='3d')
2138+
x = [1, 2, 3]
2139+
y = [0.0, 0.0, 0.0]
2140+
z = [0.0, 0.0, 0.0]
2141+
ax1.plot(x, y, z, 'o-')
2142+
2143+
# mutate y,z to get a nontrivial line
2144+
y[:] = [1, 2, 3]
2145+
z[:] = [1, 2, 3]
2146+
2147+
# draw the same plot without mutating x and y
2148+
ax2 = fig_ref.add_subplot(111, projection='3d')
2149+
x = [1, 2, 3]
2150+
y = [0.0, 0.0, 0.0]
2151+
z = [0.0, 0.0, 0.0]
2152+
ax2.plot(x, y, z, 'o-')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy