diff options
Diffstat (limited to 'numpy/lib')
-rw-r--r-- | numpy/lib/shape_base.py | 8 | ||||
-rw-r--r-- | numpy/lib/tests/test_shape_base.py | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/numpy/lib/shape_base.py b/numpy/lib/shape_base.py index 3cb4dc19c..154faa1dd 100644 --- a/numpy/lib/shape_base.py +++ b/numpy/lib/shape_base.py @@ -644,8 +644,8 @@ def column_stack(tup): """ if not overrides.ARRAY_FUNCTION_ENABLED: - # raise warning if necessary - _arrays_for_stack_dispatcher(tup, stacklevel=2) + # reject non-sequences (and make tuple) + tup = _arrays_for_stack_dispatcher(tup) arrays = [] for v in tup: @@ -714,8 +714,8 @@ def dstack(tup): """ if not overrides.ARRAY_FUNCTION_ENABLED: - # raise warning if necessary - _arrays_for_stack_dispatcher(tup, stacklevel=2) + # reject non-sequences (and make tuple) + tup = _arrays_for_stack_dispatcher(tup) arrs = atleast_3d(*tup) if not isinstance(arrs, list): diff --git a/numpy/lib/tests/test_shape_base.py b/numpy/lib/tests/test_shape_base.py index 76058cf20..eb6628904 100644 --- a/numpy/lib/tests/test_shape_base.py +++ b/numpy/lib/tests/test_shape_base.py @@ -492,7 +492,7 @@ class TestColumnStack: assert_equal(actual, expected) def test_generator(self): - with assert_warns(FutureWarning): + with pytest.raises(TypeError, match="arrays to stack must be"): column_stack((np.arange(3) for _ in range(2))) @@ -529,7 +529,7 @@ class TestDstack: assert_array_equal(res, desired) def test_generator(self): - with assert_warns(FutureWarning): + with pytest.raises(TypeError, match="arrays to stack must be"): dstack((np.arange(3) for _ in range(2))) |