1
- import unittest
2
-
3
1
import numpy
4
2
import pytest
5
3
6
4
import dpnp as cupy
5
+ from tests .helper import has_support_aspect64
7
6
from tests .third_party .cupy import testing
8
7
9
8
10
- class TestJoin (unittest .TestCase ):
11
- @pytest .mark .skip ("dpnp.column_stack() is not implemented yet" )
9
+ class TestJoin :
12
10
@testing .for_all_dtypes (name = "dtype1" )
13
11
@testing .for_all_dtypes (name = "dtype2" )
14
12
@testing .numpy_cupy_array_equal ()
@@ -18,21 +16,18 @@ def test_column_stack(self, xp, dtype1, dtype2):
18
16
c = testing .shaped_arange ((4 , 2 ), xp , dtype1 )
19
17
return xp .column_stack ((a , b , c ))
20
18
21
- @pytest .mark .skip ("dpnp.column_stack() is not implemented yet" )
22
19
def test_column_stack_wrong_ndim1 (self ):
23
20
a = cupy .zeros (())
24
21
b = cupy .zeros ((3 ,))
25
22
with pytest .raises (ValueError ):
26
23
cupy .column_stack ((a , b ))
27
24
28
- @pytest .mark .skip ("dpnp.column_stack() is not implemented yet" )
29
25
def test_column_stack_wrong_ndim2 (self ):
30
26
a = cupy .zeros ((3 , 2 , 3 ))
31
27
b = cupy .zeros ((3 , 2 ))
32
28
with pytest .raises (ValueError ):
33
29
cupy .column_stack ((a , b ))
34
30
35
- @pytest .mark .skip ("dpnp.column_stack() is not implemented yet" )
36
31
def test_column_stack_wrong_shape (self ):
37
32
a = cupy .zeros ((3 , 2 ))
38
33
b = cupy .zeros ((4 , 3 ))
@@ -87,9 +82,8 @@ def test_concatenate_large_4(self, xp, dtype):
87
82
b = testing .shaped_reverse_arange ((2 , 3 , 4 ), xp , dtype )
88
83
return xp .concatenate ((a , b ) * 10 , axis = - 1 )
89
84
90
- @pytest .mark .skip ("TODO: remove once dpctl #1325 is resolved" )
91
85
@testing .for_all_dtypes (name = "dtype" )
92
- @testing .numpy_cupy_array_equal ()
86
+ @testing .numpy_cupy_array_equal (type_check = has_support_aspect64 () )
93
87
def test_concatenate_large_5 (self , xp , dtype ):
94
88
a = testing .shaped_arange ((2 , 3 , 4 ), xp , dtype )
95
89
b = testing .shaped_reverse_arange ((2 , 3 , 4 ), xp , "i" )
@@ -113,8 +107,7 @@ def test_concatenate_large_f_contiguous(self, xp, dtype):
113
107
e = testing .shaped_arange ((2 , 3 , 2 ), xp , dtype )
114
108
return xp .concatenate ((a , b , c , d , e ) * 2 , axis = - 1 )
115
109
116
- @pytest .mark .skip ("TODO: remove once dpctl #1325 is resolved" )
117
- @testing .numpy_cupy_array_equal ()
110
+ @testing .numpy_cupy_array_equal (type_check = has_support_aspect64 ())
118
111
def test_concatenate_many_multi_dtype (self , xp ):
119
112
a = testing .shaped_arange ((2 , 1 ), xp , "i" )
120
113
b = testing .shaped_arange ((2 , 1 ), xp , "f" )
@@ -191,9 +184,8 @@ def test_concatenate_out_invalid_dtype(self):
191
184
with pytest .raises (TypeError ):
192
185
xp .concatenate ((a , b , c ), axis = 1 , out = out )
193
186
194
- @pytest .mark .skip ("TODO: remove once dpctl #1325 is resolved" )
195
187
@testing .for_all_dtypes_combination (names = ["dtype1" , "dtype2" ])
196
- @testing .numpy_cupy_array_equal ()
188
+ @testing .numpy_cupy_array_equal (type_check = has_support_aspect64 () )
197
189
def test_concatenate_different_dtype (self , xp , dtype1 , dtype2 ):
198
190
a = testing .shaped_arange ((3 , 4 ), xp , dtype1 )
199
191
b = testing .shaped_arange ((3 , 4 ), xp , dtype2 )
@@ -235,27 +227,23 @@ def test_concatenate_casting(self, xp, dtype1, dtype2, casting):
235
227
b = testing .shaped_arange ((3 , 4 ), xp , dtype1 )
236
228
return xp .concatenate ((a , b ), dtype = dtype2 , casting = casting )
237
229
238
- @pytest .mark .skip ("dpnp.dstack() is not implemented yet" )
239
230
@testing .numpy_cupy_array_equal ()
240
231
def test_dstack (self , xp ):
241
232
a = testing .shaped_arange ((1 , 3 , 2 ), xp )
242
233
b = testing .shaped_arange ((3 ,), xp )
243
234
c = testing .shaped_arange ((1 , 3 ), xp )
244
235
return xp .dstack ((a , b , c ))
245
236
246
- @pytest .mark .skip ("dpnp.dstack() is not implemented yet" )
247
237
@testing .numpy_cupy_array_equal ()
248
238
def test_dstack_single_element (self , xp ):
249
239
a = testing .shaped_arange ((1 , 2 , 3 ), xp )
250
240
return xp .dstack ((a ,))
251
241
252
- @pytest .mark .skip ("dpnp.dstack() is not implemented yet" )
253
242
@testing .numpy_cupy_array_equal ()
254
243
def test_dstack_single_element_2 (self , xp ):
255
244
a = testing .shaped_arange ((1 , 2 ), xp )
256
245
return xp .dstack ((a ,))
257
246
258
- @pytest .mark .skip ("dpnp.dstack() is not implemented yet" )
259
247
@testing .numpy_cupy_array_equal ()
260
248
def test_dstack_single_element_3 (self , xp ):
261
249
a = testing .shaped_arange ((1 ,), xp )
@@ -473,33 +461,30 @@ def test_stack_dtype(self, xp, dtype1, dtype2):
473
461
def test_stack_casting (self , xp , dtype1 , dtype2 , casting ):
474
462
a = testing .shaped_arange ((3 , 4 ), xp , dtype1 )
475
463
b = testing .shaped_arange ((3 , 4 ), xp , dtype1 )
464
+ # may raise TypeError or ComplexWarning
476
465
return xp .stack ((a , b ), dtype = dtype2 , casting = casting )
477
466
478
- @pytest .mark .skip ("dpnp.row_stack() is not implemented yet" )
479
467
@testing .for_all_dtypes (name = "dtype1" )
480
468
@testing .for_all_dtypes (name = "dtype2" )
481
- @testing .numpy_cupy_array_equal ()
469
+ @testing .numpy_cupy_array_equal (type_check = has_support_aspect64 () )
482
470
def test_row_stack (self , xp , dtype1 , dtype2 ):
483
471
a = testing .shaped_arange ((4 , 3 ), xp , dtype1 )
484
472
b = testing .shaped_arange ((3 ,), xp , dtype2 )
485
473
c = testing .shaped_arange ((2 , 3 ), xp , dtype1 )
486
474
return xp .row_stack ((a , b , c ))
487
475
488
- @pytest .mark .skip ("dpnp.row_stack() is not implemented yet" )
489
476
def test_row_stack_wrong_ndim1 (self ):
490
477
a = cupy .zeros (())
491
478
b = cupy .zeros ((3 ,))
492
479
with pytest .raises (ValueError ):
493
480
cupy .row_stack ((a , b ))
494
481
495
- @pytest .mark .skip ("dpnp.row_stack() is not implemented yet" )
496
482
def test_row_stack_wrong_ndim2 (self ):
497
483
a = cupy .zeros ((3 , 2 , 3 ))
498
484
b = cupy .zeros ((3 , 2 ))
499
485
with pytest .raises (ValueError ):
500
486
cupy .row_stack ((a , b ))
501
487
502
- @pytest .mark .skip ("dpnp.row_stack() is not implemented yet" )
503
488
def test_row_stack_wrong_shape (self ):
504
489
a = cupy .zeros ((3 , 2 ))
505
490
b = cupy .zeros ((4 , 3 ))
0 commit comments