@@ -613,6 +613,33 @@ def test_dask_reduce_axis_subset():
613
613
)
614
614
615
615
616
+ @pytest .mark .parametrize ("group_idx" , [[0 , 1 , 0 ], [0 , 0 , 1 ], [1 , 0 , 0 ], [1 , 1 , 0 ]])
617
+ @pytest .mark .parametrize (
618
+ "func" ,
619
+ [
620
+ # "first", "last",
621
+ "nanfirst" ,
622
+ "nanlast" ,
623
+ ],
624
+ )
625
+ @pytest .mark .parametrize (
626
+ "chunks" ,
627
+ [
628
+ None ,
629
+ pytest .param (1 , marks = pytest .mark .skipif (not has_dask , reason = "no dask" )),
630
+ pytest .param (2 , marks = pytest .mark .skipif (not has_dask , reason = "no dask" )),
631
+ pytest .param (3 , marks = pytest .mark .skipif (not has_dask , reason = "no dask" )),
632
+ ],
633
+ )
634
+ def test_first_last_useless (func , chunks , group_idx ):
635
+ array = np .array ([[0 , 0 , 0 ], [0 , 0 , 0 ]], dtype = np .int8 )
636
+ if chunks is not None :
637
+ array = dask .array .from_array (array , chunks = chunks )
638
+ actual , _ = groupby_reduce (array , np .array (group_idx ), func = func , engine = "numpy" )
639
+ expected = np .array ([[0 , 0 ], [0 , 0 ]], dtype = np .int8 )
640
+ assert_equal (actual , expected )
641
+
642
+
616
643
@pytest .mark .parametrize ("func" , ["first" , "last" , "nanfirst" , "nanlast" ])
617
644
@pytest .mark .parametrize ("axis" , [(0 , 1 )])
618
645
def test_first_last_disallowed (axis , func ):
0 commit comments