3
3
import numpy as np
4
4
from numpy .lib .shape_base import (
5
5
apply_along_axis , apply_over_axes , array_split , split , hsplit , dsplit ,
6
- vsplit , dstack , kron , tile
6
+ vsplit , dstack , column_stack , kron , tile
7
7
)
8
8
from numpy .testing import (
9
9
run_module_suite , TestCase , assert_ , assert_equal , assert_array_equal ,
@@ -175,8 +175,15 @@ def test_unequal_split(self):
175
175
a = np .arange (10 )
176
176
assert_raises (ValueError , split , a , 3 )
177
177
178
+ class TestColumnStack (TestCase ):
179
+ def test_non_iterable (self ):
180
+ assert_raises (TypeError , column_stack , 1 )
181
+
178
182
179
183
class TestDstack (TestCase ):
184
+ def test_non_iterable (self ):
185
+ assert_raises (TypeError , dstack , 1 )
186
+
180
187
def test_0D_array (self ):
181
188
a = np .array (1 )
182
189
b = np .array (2 )
@@ -212,6 +219,9 @@ class TestHsplit(TestCase):
212
219
"""Only testing for integer splits.
213
220
214
221
"""
222
+ def test_non_iterable (self ):
223
+ assert_raises (ValueError , hsplit , 1 , 1 )
224
+
215
225
def test_0D_array (self ):
216
226
a = np .array (1 )
217
227
try :
@@ -238,6 +248,13 @@ class TestVsplit(TestCase):
238
248
"""Only testing for integer splits.
239
249
240
250
"""
251
+ def test_non_iterable (self ):
252
+ assert_raises (ValueError , vsplit , 1 , 1 )
253
+
254
+ def test_0D_array (self ):
255
+ a = np .array (1 )
256
+ assert_raises (ValueError , vsplit , a , 2 )
257
+
241
258
def test_1D_array (self ):
242
259
a = np .array ([1 , 2 , 3 , 4 ])
243
260
try :
@@ -256,6 +273,16 @@ def test_2D_array(self):
256
273
257
274
class TestDsplit (TestCase ):
258
275
# Only testing for integer splits.
276
+ def test_non_iterable (self ):
277
+ assert_raises (ValueError , dsplit , 1 , 1 )
278
+
279
+ def test_0D_array (self ):
280
+ a = np .array (1 )
281
+ assert_raises (ValueError , dsplit , a , 2 )
282
+
283
+ def test_1D_array (self ):
284
+ a = np .array ([1 , 2 , 3 , 4 ])
285
+ assert_raises (ValueError , dsplit , a , 2 )
259
286
260
287
def test_2D_array (self ):
261
288
a = np .array ([[1 , 2 , 3 , 4 ],
0 commit comments