From 0a9da01121b0f13d4e87fa44fbff7ba04472e314 Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Fri, 26 Apr 2013 23:26:58 +0200 Subject: BUG: np.insert must copy index array Otherwise it would do in-place changes to it. Fixes gh-3279. --- numpy/lib/tests/test_function_base.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'numpy/lib/tests/test_function_base.py') diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index ae68be41f..5342aff4b 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -231,6 +231,10 @@ class TestInsert(TestCase): a = np.array(1).view(SubClass) assert_(isinstance(np.insert(a, 0, [0]), SubClass)) + def test_index_array_copied(self): + x = np.array([1, 1, 1]) + np.insert([0, 1, 2], x, [3, 4, 5]) + assert_equal(x, np.array([1, 1, 1])) class TestAmax(TestCase): def test_basic(self): -- cgit v1.2.1