From ea768739dab69c0b67488179ffa67d57d63d59f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Hartmann?= Date: Tue, 9 Jul 2013 15:49:32 +0200 Subject: BUG: Make np.insert check for out of bounds axis arguments. Also add test for IndexError exception when axis is out of bounds. --- 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 13f907d5a..de561e55a 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -218,6 +218,10 @@ class TestInsert(TestCase): assert_equal(insert(a, 1, a[:,2,:], axis=-2), insert(a, 1, a[:,2,:], axis=1)) + # invalid axis value + assert_raises(IndexError, insert, a, 1, a[:,2,:], axis=3) + assert_raises(IndexError, insert, a, 1, a[:,2,:], axis=-4) + def test_0d(self): # This is an error in the future a = np.array(1) -- cgit v1.2.1