From b1b67d65503b46f7da04785656b145ee82cc0157 Mon Sep 17 00:00:00 2001 From: Ben Rowland Date: Sat, 31 Dec 2016 16:52:47 +0000 Subject: BUG: Fix apply_along_axis() for when func1d() returns a non-ndarray (#8426) * BUG: Closes issue #8419 Fixes issue in apply_along_axis() where func1d() returns a non ndarray * BUG: Fix apply_along_axis() when func1d() returns a non-ndarray Closes issue #8419. Fixes issue in apply_along_axis() where func1d() returns a non ndarray by calling asanyarray() on result. This commit fixes a too long line in the test case. --- numpy/lib/tests/test_shape_base.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'numpy/lib/tests/test_shape_base.py') diff --git a/numpy/lib/tests/test_shape_base.py b/numpy/lib/tests/test_shape_base.py index 2eb4a809d..a716d3b38 100644 --- a/numpy/lib/tests/test_shape_base.py +++ b/numpy/lib/tests/test_shape_base.py @@ -58,6 +58,12 @@ class TestApplyAlongAxis(TestCase): assert isinstance(res, MinimalSubclass) assert_array_equal(res, np.array([6, 6, 6]).view(MinimalSubclass)) + def test_tuple_func1d(self): + def sample_1d(x): + return x[1], x[0] + res = np.apply_along_axis(sample_1d, 1, np.array([[1, 2], [3, 4]])) + assert_array_equal(res, np.array([[2, 1], [4, 3]])) + class TestApplyOverAxes(TestCase): def test_simple(self): -- cgit v1.2.1