@@ -595,6 +595,24 @@ def test_min_count(dim_num, dtype, dask, func, aggdim):
595
595
assert_dask_array (actual , dask )
596
596
597
597
598
+ @pytest .mark .parametrize ("dtype" , [float , int , np .float32 , np .bool_ ])
599
+ @pytest .mark .parametrize ("dask" , [False , True ])
600
+ @pytest .mark .parametrize ("func" , ["sum" , "prod" ])
601
+ def test_min_count_nd (dtype , dask , func ):
602
+ if dask and not has_dask :
603
+ pytest .skip ("requires dask" )
604
+
605
+ min_count = 3
606
+ dim_num = 3
607
+ da = construct_dataarray (dim_num , dtype , contains_nan = True , dask = dask )
608
+ actual = getattr (da , func )(dim = ["x" , "y" , "z" ], skipna = True , min_count = min_count )
609
+ # Supplying all dims is equivalent to supplying `...` or `None`
610
+ expected = getattr (da , func )(dim = ..., skipna = True , min_count = min_count )
611
+
612
+ assert_allclose (actual , expected )
613
+ assert_dask_array (actual , dask )
614
+
615
+
598
616
@pytest .mark .parametrize ("func" , ["sum" , "prod" ])
599
617
def test_min_count_dataset (func ):
600
618
da = construct_dataarray (2 , dtype = float , contains_nan = True , dask = False )
@@ -606,14 +624,15 @@ def test_min_count_dataset(func):
606
624
607
625
@pytest .mark .parametrize ("dtype" , [float , int , np .float32 , np .bool_ ])
608
626
@pytest .mark .parametrize ("dask" , [False , True ])
627
+ @pytest .mark .parametrize ("skipna" , [False , True ])
609
628
@pytest .mark .parametrize ("func" , ["sum" , "prod" ])
610
- def test_multiple_dims (dtype , dask , func ):
629
+ def test_multiple_dims (dtype , dask , skipna , func ):
611
630
if dask and not has_dask :
612
631
pytest .skip ("requires dask" )
613
632
da = construct_dataarray (3 , dtype , contains_nan = True , dask = dask )
614
633
615
- actual = getattr (da , func )(("x" , "y" ))
616
- expected = getattr (getattr (da , func )("x" ), func )("y" )
634
+ actual = getattr (da , func )(("x" , "y" ), skipna = skipna )
635
+ expected = getattr (getattr (da , func )("x" , skipna = skipna ), func )("y" , skipna = skipna )
617
636
assert_allclose (actual , expected )
618
637
619
638
0 commit comments