diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2016-03-02 16:41:00 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2016-03-02 16:41:00 -0700 |
commit | 8ccfedefe9126ceac422158be59c5e5d8fba237b (patch) | |
tree | 18e4cf540ace8b392a9cb7b66b1b10e5369cb971 /numpy/lib/tests | |
parent | 25ac6b10fec858d878b06cd28432ffdb0fc16012 (diff) | |
parent | 4aac3ae8dd02d070b8641113e0c486e7213a5c9a (diff) | |
download | numpy-8ccfedefe9126ceac422158be59c5e5d8fba237b.tar.gz |
Merge pull request #7366 from gkBCCN/bug-fix-6542-reloaded
TST: fix #6542, add tests to check non-iterable argument raises in hstack and related functions.
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r-- | numpy/lib/tests/test_shape_base.py | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/numpy/lib/tests/test_shape_base.py b/numpy/lib/tests/test_shape_base.py index 3f05f80c0..0177a5729 100644 --- a/numpy/lib/tests/test_shape_base.py +++ b/numpy/lib/tests/test_shape_base.py @@ -3,7 +3,7 @@ from __future__ import division, absolute_import, print_function import numpy as np from numpy.lib.shape_base import ( apply_along_axis, apply_over_axes, array_split, split, hsplit, dsplit, - vsplit, dstack, kron, tile + vsplit, dstack, column_stack, kron, tile ) from numpy.testing import ( run_module_suite, TestCase, assert_, assert_equal, assert_array_equal, @@ -175,8 +175,15 @@ class TestSplit(TestCase): a = np.arange(10) assert_raises(ValueError, split, a, 3) +class TestColumnStack(TestCase): + def test_non_iterable(self): + assert_raises(TypeError, column_stack, 1) + class TestDstack(TestCase): + def test_non_iterable(self): + assert_raises(TypeError, dstack, 1) + def test_0D_array(self): a = np.array(1) b = np.array(2) @@ -212,6 +219,9 @@ class TestHsplit(TestCase): """Only testing for integer splits. """ + def test_non_iterable(self): + assert_raises(ValueError, hsplit, 1, 1) + def test_0D_array(self): a = np.array(1) try: @@ -238,6 +248,13 @@ class TestVsplit(TestCase): """Only testing for integer splits. """ + def test_non_iterable(self): + assert_raises(ValueError, vsplit, 1, 1) + + def test_0D_array(self): + a = np.array(1) + assert_raises(ValueError, vsplit, a, 2) + def test_1D_array(self): a = np.array([1, 2, 3, 4]) try: @@ -256,6 +273,16 @@ class TestVsplit(TestCase): class TestDsplit(TestCase): # Only testing for integer splits. + def test_non_iterable(self): + assert_raises(ValueError, dsplit, 1, 1) + + def test_0D_array(self): + a = np.array(1) + assert_raises(ValueError, dsplit, a, 2) + + def test_1D_array(self): + a = np.array([1, 2, 3, 4]) + assert_raises(ValueError, dsplit, a, 2) def test_2D_array(self): a = np.array([[1, 2, 3, 4], |