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,17 @@ 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
+ try :
257
+ vsplit (a , 2 )
258
+ assert_ (0 )
259
+ except ValueError :
260
+ pass
261
+
241
262
def test_1D_array (self ):
242
263
a = np .array ([1 , 2 , 3 , 4 ])
243
264
try :
@@ -256,6 +277,24 @@ def test_2D_array(self):
256
277
257
278
class TestDsplit (TestCase ):
258
279
# Only testing for integer splits.
280
+ def test_non_iterable (self ):
281
+ assert_raises (ValueError , dsplit , 1 ,1 )
282
+
283
+ def test_0D_array (self ):
284
+ a = np .array (1 )
285
+ try :
286
+ dsplit (a , 2 )
287
+ assert_ (0 )
288
+ except ValueError :
289
+ pass
290
+
291
+ def test_1D_array (self ):
292
+ a = np .array ([1 , 2 , 3 , 4 ])
293
+ try :
294
+ dsplit (a , 2 )
295
+ assert_ (0 )
296
+ except ValueError :
297
+ pass
259
298
260
299
def test_2D_array (self ):
261
300
a = np .array ([[1 , 2 , 3 , 4 ],
0 commit comments