@@ -138,7 +138,9 @@ class UserNdarray(cupy.ndarray):
138138 )
139139)
140140class TestNdarrayInitStrides (unittest .TestCase ):
141+
141142 # Check the strides given shape, itemsize and order.
143+
142144 @testing .numpy_cupy_equal ()
143145 def test_strides (self , xp ):
144146 arr = xp .ndarray (self .shape , dtype = self .dtype , order = self .order )
@@ -149,6 +151,7 @@ def test_strides(self, xp):
149151
150152
151153class TestNdarrayInitRaise (unittest .TestCase ):
154+
152155 def test_unsupported_type (self ):
153156 arr = numpy .ndarray ((2 , 3 ), dtype = object )
154157 with pytest .raises (TypeError ):
@@ -177,6 +180,7 @@ def test_excessive_ndim(self):
177180)
178181@pytest .mark .skip ("deepcopy() is not supported" )
179182class TestNdarrayDeepCopy (unittest .TestCase ):
183+
180184 def _check_deepcopy (self , arr , arr2 ):
181185 assert arr .data is not arr2 .data
182186 assert arr .shape == arr2 .shape
@@ -218,6 +222,7 @@ def test_deepcopy_multi_device(self):
218222
219223
220224class TestNdarrayCopy :
225+
221226 @testing .multi_gpu (2 )
222227 @testing .for_orders ("CFA" )
223228 def test_copy_multi_device_non_contiguous (self , order ):
@@ -265,6 +270,7 @@ def test_copy_multi_device_with_stream(self):
265270
266271
267272class TestNdarrayShape (unittest .TestCase ):
273+
268274 @testing .numpy_cupy_array_equal ()
269275 def test_shape_set (self , xp ):
270276 arr = xp .ndarray ((2 , 3 ))
@@ -298,6 +304,7 @@ def test_shape_need_copy(self):
298304
299305@pytest .mark .skip ("CUDA interface is not supported" )
300306class TestNdarrayCudaInterface (unittest .TestCase ):
307+
301308 def test_cuda_array_interface (self ):
302309 arr = cupy .zeros (shape = (2 , 3 ), dtype = cupy .float64 )
303310 iface = arr .__cuda_array_interface__
@@ -428,6 +435,7 @@ def test_cuda_array_interface_stream(self):
428435
429436@pytest .mark .skip ("CUDA interface is not supported" )
430437class TestNdarrayCudaInterfaceNoneCUDA (unittest .TestCase ):
438+
431439 def setUp (self ):
432440 self .arr = cupy .zeros (shape = (2 , 3 ), dtype = cupy .float64 )
433441
@@ -449,6 +457,7 @@ def test_cuda_array_interface_getattr(self):
449457 )
450458)
451459class TestNdarrayTake (unittest .TestCase ):
460+
452461 shape = (3 , 4 , 5 )
453462
454463 @testing .for_all_dtypes ()
@@ -472,6 +481,7 @@ def test_take(self, xp, dtype):
472481 )
473482)
474483class TestNdarrayTakeWithInt (unittest .TestCase ):
484+
475485 shape = (3 , 4 , 5 )
476486
477487 @testing .for_all_dtypes ()
@@ -490,6 +500,7 @@ def test_take(self, xp, dtype):
490500 )
491501)
492502class TestNdarrayTakeWithIntWithOutParam (unittest .TestCase ):
503+
493504 shape = (3 , 4 , 5 )
494505
495506 @testing .for_all_dtypes ()
@@ -512,6 +523,7 @@ def test_take(self, xp, dtype):
512523 )
513524)
514525class TestScalaNdarrayTakeWithIntWithOutParam (unittest .TestCase ):
526+
515527 shape = ()
516528
517529 @testing .for_all_dtypes ()
@@ -530,6 +542,7 @@ def test_take(self, xp, dtype):
530542 {"shape" : (), "indices" : (0 ,), "axis" : 2 },
531543)
532544class TestNdarrayTakeErrorAxisOverRun (unittest .TestCase ):
545+
533546 def test_axis_overrun1 (self ):
534547 for xp in (numpy , cupy ):
535548 a = testing .shaped_arange (self .shape , xp )
@@ -547,6 +560,7 @@ def test_axis_overrun2(self):
547560 {"shape" : (), "indices" : (), "out_shape" : (1 ,)},
548561)
549562class TestNdarrayTakeErrorShapeMismatch (unittest .TestCase ):
563+
550564 def test_shape_mismatch (self ):
551565 for xp in (numpy , cupy ):
552566 a = testing .shaped_arange (self .shape , xp )
@@ -561,6 +575,7 @@ def test_shape_mismatch(self):
561575 {"shape" : (), "indices" : (), "out_shape" : ()},
562576)
563577class TestNdarrayTakeErrorTypeMismatch (unittest .TestCase ):
578+
564579 def test_output_type_mismatch (self ):
565580 for xp in (numpy , cupy ):
566581 a = testing .shaped_arange (self .shape , xp , numpy .int32 )
@@ -576,6 +591,7 @@ def test_output_type_mismatch(self):
576591 {"shape" : (3 , 0 ), "indices" : (2 ,), "axis" : 0 },
577592)
578593class TestZeroSizedNdarrayTake (unittest .TestCase ):
594+
579595 @testing .numpy_cupy_array_equal ()
580596 def test_output_type_mismatch (self , xp ):
581597 a = testing .shaped_arange (self .shape , xp , numpy .int32 )
@@ -588,6 +604,7 @@ def test_output_type_mismatch(self, xp):
588604 {"shape" : (0 ,), "indices" : (1 , 1 )},
589605)
590606class TestZeroSizedNdarrayTakeIndexError (unittest .TestCase ):
607+
591608 def test_output_type_mismatch (self ):
592609 for xp in (numpy , cupy ):
593610 a = testing .shaped_arange (self .shape , xp , numpy .int32 )
@@ -597,6 +614,7 @@ def test_output_type_mismatch(self):
597614
598615
599616class TestSize (unittest .TestCase ):
617+
600618 @testing .numpy_cupy_equal ()
601619 def test_size_without_axis (self , xp ):
602620 x = testing .shaped_arange ((3 , 4 , 5 ), xp , numpy .int32 )
@@ -638,6 +656,7 @@ def test_size_zero_dim_array_with_axis(self):
638656
639657@pytest .mark .skip ("python interface is not supported" )
640658class TestPythonInterface (unittest .TestCase ):
659+
641660 @testing .for_all_dtypes ()
642661 @testing .numpy_cupy_equal ()
643662 def test_bytes_tobytes (self , xp , dtype ):
@@ -674,13 +693,15 @@ def test_format(self, xp):
674693
675694@pytest .mark .skip ("implicit conversation to numpy does not raise an exception" )
676695class TestNdarrayImplicitConversion (unittest .TestCase ):
696+
677697 def test_array (self ):
678698 a = testing .shaped_arange ((3 , 4 , 5 ), cupy , numpy .int64 )
679699 with pytest .raises (TypeError ):
680700 numpy .asarray (a )
681701
682702
683703class C (cupy .ndarray ):
704+
684705 def __new__ (cls , * args , info = None , ** kwargs ):
685706 obj = super ().__new__ (cls , * args , ** kwargs )
686707 obj .info = info
@@ -694,6 +715,7 @@ def __array_finalize__(self, obj):
694715
695716@pytest .mark .skip ("SAT-7168: explicit constructor call is not supported" )
696717class TestNdarraySubclass :
718+
697719 def test_explicit_constructor_call (self ):
698720 a = C ([0 , 1 , 2 , 3 ], info = "information" )
699721 assert type (a ) is C
0 commit comments