44
44
assert_equal_tuple ,
45
45
has_cubed ,
46
46
has_dask ,
47
+ has_sparse ,
47
48
raise_if_dask_computes ,
48
49
requires_cubed ,
49
50
requires_dask ,
@@ -459,7 +460,18 @@ def test_numpy_reduce_nd_md():
459
460
460
461
461
462
@requires_dask
462
- @pytest .mark .parametrize ("reindex" , [None , False , True ])
463
+ @pytest .mark .parametrize (
464
+ "reindex" ,
465
+ [
466
+ None ,
467
+ False ,
468
+ True ,
469
+ pytest .param (
470
+ ReindexStrategy (blockwise = False , array_type = ReindexArrayType .SPARSE_COO ),
471
+ marks = pytest .mark .skipif (not has_sparse , reason = "no sparse" ),
472
+ ),
473
+ ],
474
+ )
463
475
@pytest .mark .parametrize ("func" , ALL_FUNCS )
464
476
@pytest .mark .parametrize ("add_nan" , [False , True ])
465
477
@pytest .mark .parametrize ("dtype" , (float ,))
@@ -482,6 +494,9 @@ def test_groupby_agg_dask(func, shape, array_chunks, group_chunks, add_nan, dtyp
482
494
if "arg" in func and (engine in ["flox" , "numbagg" ] or reindex ):
483
495
pytest .skip ()
484
496
497
+ if isinstance (reindex , ReindexStrategy ) and not _is_sparse_supported_reduction (func ):
498
+ pytest .skip ()
499
+
485
500
rng = np .random .default_rng (12345 )
486
501
array = dask .array .from_array (rng .random (shape ), chunks = array_chunks ).astype (dtype )
487
502
array = dask .array .ones (shape , chunks = array_chunks )
@@ -787,6 +802,11 @@ def test_groupby_reduce_axis_subset_against_numpy(func, axis, engine):
787
802
(None , None ),
788
803
pytest .param (False , (2 , 2 , 3 ), marks = requires_dask ),
789
804
pytest .param (True , (2 , 2 , 3 ), marks = requires_dask ),
805
+ pytest .param (
806
+ ReindexStrategy (blockwise = False , array_type = ReindexArrayType .SPARSE_COO ),
807
+ (2 , 2 , 3 ),
808
+ marks = (requires_dask , pytest .mark .skipif (not has_sparse , reason = "no sparse" )),
809
+ ),
790
810
],
791
811
)
792
812
@pytest .mark .parametrize (
0 commit comments