5858 squeezed_shape ,
5959 to_nparray ,
6060)
61- from hypothesis import assume , given , settings
61+ from hypothesis import assume , example , given , settings
6262from hypothesis import strategies as st
6363
6464cp = gpu_only_import ("cupy" )
@@ -125,6 +125,14 @@ def _assert_equal(array_like, cuml_array):
125125 )
126126
127127
128+ @example (
129+ input_type = "numpy" ,
130+ dtype = np .float32 ,
131+ shape = (10 , 10 ),
132+ order = "C" ,
133+ mem_type = "device" ,
134+ force_gc = False ,
135+ )
128136@given (
129137 input_type = cuml_array_input_types (),
130138 dtype = cuml_array_dtypes (),
@@ -164,6 +172,13 @@ def test_array_init(input_type, dtype, shape, order, mem_type, force_gc):
164172 _assert_equal (input_array_copy , cuml_array )
165173
166174
175+ @example (
176+ data_type = bytes ,
177+ dtype = np .float32 ,
178+ shape = (10 , 10 ),
179+ order = "C" ,
180+ mem_type = "device" ,
181+ )
167182@given (
168183 data_type = st .sampled_from ([bytes , bytearray , memoryview ]),
169184 dtype = cuml_array_dtypes (),
@@ -193,6 +208,13 @@ def test_array_init_from_bytes(data_type, dtype, shape, order, mem_type):
193208 assert cp .all (cp .asarray (array_copy ) == array_copy )
194209
195210
211+ @example (
212+ input_type = "numpy" ,
213+ dtype = np .float32 ,
214+ shape = (10 , 10 ),
215+ order = "C" ,
216+ mem_type = "device" ,
217+ )
196218@given (
197219 input_type = cuml_array_input_types (),
198220 dtype = cuml_array_dtypes (),
@@ -226,6 +248,7 @@ def test_array_mem_type(input_type, dtype, shape, order, mem_type):
226248 )
227249
228250
251+ @example (inp = np .array ([1 , 2 , 3 ]), indices = slice (1 , 3 ), mem_type = "device" )
229252@given (
230253 inp = cuml_array_inputs (),
231254 indices = st .slices (10 ), # TODO: should be basic_indices() as shown below
@@ -263,6 +286,7 @@ def test_get_set_item(inp, indices, mem_type):
263286 _assert_equal (inp , ary )
264287
265288
289+ @example (shape = (10 , 10 ), dtype = np .float32 , order = "C" , mem_type = "device" )
266290@given (
267291 shape = cuml_array_shapes (),
268292 dtype = cuml_array_dtypes (),
@@ -278,6 +302,7 @@ def test_create_empty(shape, dtype, order, mem_type):
278302 assert ary .dtype == np .dtype (dtype )
279303
280304
305+ @example (shape = (10 , 10 ), dtype = np .float32 , order = "C" , mem_type = "device" )
281306@given (
282307 shape = cuml_array_shapes (),
283308 dtype = cuml_array_dtypes (),
@@ -293,6 +318,7 @@ def test_create_zeros(shape, dtype, order, mem_type):
293318 assert mem_type .xpy .all (test == mem_type .xpy .asarray (ary ))
294319
295320
321+ @example (shape = (10 , 10 ), dtype = np .float32 , order = "C" , mem_type = "device" )
296322@given (
297323 shape = cuml_array_shapes (),
298324 dtype = cuml_array_dtypes (),
@@ -308,6 +334,7 @@ def test_create_ones(shape, dtype, order, mem_type):
308334 assert mem_type .xpy .all (test == mem_type .xpy .asarray (ary ))
309335
310336
337+ @example (shape = (10 , 10 ), dtype = np .float32 , order = "C" , mem_type = "device" )
311338@given (
312339 shape = cuml_array_shapes (),
313340 dtype = cuml_array_dtypes (),
@@ -332,6 +359,7 @@ def cudf_compatible_dtypes(dtype):
332359 return dtype not in UNSUPPORTED_CUDF_DTYPES
333360
334361
362+ @example (inp = np .array ([1 , 2 , 3 ]), input_mem_type = "device" , output_type = "cupy" )
335363@given (
336364 inp = cuml_array_inputs (),
337365 input_mem_type = cuml_array_mem_types (),
@@ -391,6 +419,7 @@ def assert_data_equal_(res):
391419 assert_data_equal_ (res )
392420
393421
422+ @example (inp = np .array ([1 , 2 , 3 ]), output_type = "cupy" , mem_type = "device" )
394423@given (
395424 inp = cuml_array_inputs (),
396425 output_type = cuml_array_output_types (),
@@ -441,6 +470,14 @@ def test_end_to_end_conversion_via_intermediate(inp, output_type, mem_type):
441470 _assert_equal (inp , array2 )
442471
443472
473+ @example (
474+ output_type = "cupy" ,
475+ shape = (10 , 10 ),
476+ dtype = np .float32 ,
477+ order = "C" ,
478+ out_dtype = np .float32 ,
479+ mem_type = "device" ,
480+ )
444481@given (
445482 output_type = cuml_array_output_types (),
446483 shape = cuml_array_shapes (),
@@ -472,6 +509,7 @@ def test_output_dtype(output_type, shape, dtype, order, out_dtype, mem_type):
472509 res .dtype is out_dtype
473510
474511
512+ @example (inp = np .array ([1 , 2 , 3 ]), mem_type = "device" )
475513@given (inp = cuml_array_inputs (), mem_type = cuml_array_mem_types ())
476514@settings (deadline = None )
477515def test_array_interface (inp , mem_type ):
@@ -522,6 +560,11 @@ def test_array_interface(inp, mem_type):
522560 )
523561
524562
563+ @example (
564+ inp = np .array ([1 , 2 , 3 ]),
565+ to_serialize_mem_type = "device" ,
566+ from_serialize_mem_type = "device" ,
567+ )
525568@given (
526569 inp = cuml_array_inputs (),
527570 to_serialize_mem_type = cuml_array_mem_types (),
@@ -561,6 +604,11 @@ def test_serialize(inp, to_serialize_mem_type, from_serialize_mem_type):
561604
562605
563606@pytest .mark .parametrize ("protocol" , [4 , 5 ])
607+ @example (
608+ inp = np .array ([1 , 2 , 3 ]),
609+ to_serialize_mem_type = "device" ,
610+ from_serialize_mem_type = "device" ,
611+ )
564612@given (
565613 inp = cuml_array_inputs (),
566614 to_serialize_mem_type = cuml_array_mem_types (),
@@ -601,6 +649,7 @@ def test_pickle(protocol, inp, to_serialize_mem_type, from_serialize_mem_type):
601649 assert ary .order == b .order
602650
603651
652+ @example (inp = np .array ([1 , 2 , 3 ]), mem_type = "device" )
604653@given (inp = cuml_array_inputs (), mem_type = cuml_array_mem_types ())
605654@settings (deadline = None )
606655def test_deepcopy (inp , mem_type ):
@@ -633,6 +682,7 @@ def test_deepcopy(inp, mem_type):
633682
634683
635684@pytest .mark .parametrize ("operation" , [operator .add , operator .sub ])
685+ @example (a = np .array ([1 , 2 , 3 ]), mem_type = "device" )
636686@given (
637687 a = cuml_array_inputs (),
638688 mem_type = cuml_array_mem_types (),
@@ -652,6 +702,7 @@ def test_cumlary_binops(operation, a, mem_type):
652702
653703
654704@pytest .mark .parametrize ("order" , ["F" , "C" ])
705+ @example (mem_type = "device" )
655706@given (mem_type = cuml_array_mem_types ())
656707@settings (deadline = None )
657708def test_sliced_array_owner (order , mem_type ):
@@ -701,6 +752,7 @@ def test_sliced_array_owner(order, mem_type):
701752 )
702753
703754
755+ @example (input_type = "numpy" , dtype = np .float32 , shape = (10 , 10 ), order = "C" )
704756@given (
705757 input_type = cuml_array_input_types (),
706758 dtype = cuml_array_dtypes (),
@@ -713,6 +765,7 @@ def test_array_to_memory_order(input_type, dtype, shape, order):
713765 assert array_to_memory_order (input_array , default = order ) == order
714766
715767
768+ @example (input_type = "numpy" , dtype = np .float32 , shape = (10 , 10 ), order = "C" )
716769@given (
717770 input_type = st .sampled_from (("cupy" , "numpy" )),
718771 dtype = cuml_array_dtypes (),
0 commit comments