@@ -365,7 +365,7 @@ def test_label_output_dtype(xp):
365365 assert output .dtype == t
366366
367367
368- @xfail_xp_backends ('dask.array' , reason = 'Dask does not raise' )
368+ @skip_xp_backends ('dask.array' , reason = 'Dask does not raise' )
369369@xfail_xp_backends ('jax.numpy' , reason = 'JAX does not raise' )
370370def test_label_output_wrong_size (xp ):
371371 data = xp .ones ([5 ])
@@ -554,6 +554,7 @@ def test_value_indices02(xp):
554554 ndimage .value_indices (data )
555555
556556
557+ @skip_xp_backends ("dask.array" , reason = "len on data-dependent output shapes" )
557558def test_value_indices03 (xp ):
558559 "Test different input array shapes, from 1-D to 4-D"
559560 for shape in [(36 ,), (18 , 2 ), (3 , 3 , 4 ), (3 , 3 , 2 , 2 )]:
@@ -673,6 +674,7 @@ def test_sum11(xp):
673674 assert_almost_equal (output , xp .asarray (6.0 ), check_0d = False )
674675
675676
677+ @skip_xp_backends ("dask.array" , reason = "data-dependent output shapes" )
676678def test_sum12 (xp ):
677679 labels = xp .asarray ([[1 , 2 ], [2 , 4 ]], dtype = xp .int8 )
678680 for type in types :
@@ -682,6 +684,7 @@ def test_sum12(xp):
682684 assert_array_almost_equal (output , xp .asarray ([4.0 , 0.0 , 5.0 ]))
683685
684686
687+ @skip_xp_backends ("dask.array" , reason = "data-dependent output shapes" )
685688def test_sum_labels (xp ):
686689 labels = xp .asarray ([[1 , 2 ], [2 , 4 ]], dtype = xp .int8 )
687690 for type in types :
@@ -694,7 +697,7 @@ def test_sum_labels(xp):
694697 assert xp .all (output_sum == output_labels )
695698 assert_array_almost_equal (output_labels , xp .asarray ([4.0 , 0.0 , 5.0 ]))
696699
697-
700+ @ skip_xp_backends ( "dask.array" , reason = "dask outputs wrong results here" )
698701def test_mean01 (xp ):
699702 labels = np .asarray ([1 , 0 ], dtype = bool )
700703 labels = xp .asarray (labels )
@@ -705,6 +708,7 @@ def test_mean01(xp):
705708 assert_almost_equal (output , xp .asarray (2.0 ), check_0d = False )
706709
707710
711+ @skip_xp_backends ("dask.array" , reason = "dask outputs wrong results here" )
708712def test_mean02 (xp ):
709713 labels = np .asarray ([1 , 0 ], dtype = bool )
710714 input = np .asarray ([[1 , 2 ], [3 , 4 ]], dtype = bool )
@@ -715,6 +719,7 @@ def test_mean02(xp):
715719 assert_almost_equal (output , xp .asarray (1.0 ), check_0d = False )
716720
717721
722+ @skip_xp_backends ("dask.array" , reason = "dask outputs wrong results here" )
718723def test_mean03 (xp ):
719724 labels = xp .asarray ([1 , 2 ])
720725 for type in types :
@@ -725,6 +730,7 @@ def test_mean03(xp):
725730 assert_almost_equal (output , xp .asarray (3.0 ), check_0d = False )
726731
727732
733+ @skip_xp_backends ("dask.array" , reason = "dask outputs wrong results here" )
728734def test_mean04 (xp ):
729735 labels = xp .asarray ([[1 , 2 ], [2 , 4 ]], dtype = xp .int8 )
730736 with np .errstate (all = 'ignore' ):
@@ -828,6 +834,7 @@ def test_maximum05(xp):
828834 assert ndimage .maximum (x ) == - 1
829835
830836
837+ @pytest .mark .filterwarnings ("ignore::FutureWarning:dask" )
831838def test_median01 (xp ):
832839 a = xp .asarray ([[1 , 2 , 0 , 1 ],
833840 [5 , 3 , 0 , 4 ],
@@ -850,6 +857,7 @@ def test_median02(xp):
850857 assert_almost_equal (output , xp .asarray (1.0 ), check_0d = False )
851858
852859
860+ @skip_xp_backends ("dask.array" , reason = "dask.array.median only implemented for along an axis." )
853861def test_median03 (xp ):
854862 a = xp .asarray ([[1 , 2 , 0 , 1 ],
855863 [5 , 3 , 0 , 4 ],
@@ -863,14 +871,15 @@ def test_median03(xp):
863871 assert_almost_equal (output , xp .asarray (3.0 ), check_0d = False )
864872
865873
874+ @skip_xp_backends ("dask.array" , reason = "Crash inside dask searchsorted" )
866875def test_median_gh12836_bool (xp ):
867876 # test boolean addition fix on example from gh-12836
868877 a = np .asarray ([1 , 1 ], dtype = bool )
869878 a = xp .asarray (a )
870879 output = ndimage .median (a , labels = xp .ones ((2 ,)), index = xp .asarray ([1 ]))
871880 assert_array_almost_equal (output , xp .asarray ([1.0 ]))
872881
873-
882+ @ skip_xp_backends ( "dask.array" , reason = "Crash inside dask searchsorted" )
874883def test_median_no_int_overflow (xp ):
875884 # test integer overflow fix on example from gh-12836
876885 a = xp .asarray ([65 , 70 ], dtype = xp .int8 )
@@ -911,7 +920,9 @@ def test_variance04(xp):
911920 output = ndimage .variance (input )
912921 assert_almost_equal (output , xp .asarray (0.25 ), check_0d = False )
913922
914-
923+ # dask.array is maybe due to failed conversion to numpy?
924+ # array-api-strict should've caught use of non array API functions I think
925+ @skip_xp_backends ("dask.array" , reason = "conjugate called on dask.array which doesn't exist" )
915926def test_variance05 (xp ):
916927 labels = xp .asarray ([2 , 2 , 3 ])
917928 for type in types :
@@ -921,7 +932,7 @@ def test_variance05(xp):
921932 output = ndimage .variance (input , labels , 2 )
922933 assert_almost_equal (output , xp .asarray (1.0 ), check_0d = False )
923934
924-
935+ @ skip_xp_backends ( "dask.array" , reason = "Data-dependent output shapes" )
925936def test_variance06 (xp ):
926937 labels = xp .asarray ([2 , 2 , 3 , 3 , 4 ])
927938 with np .errstate (all = 'ignore' ):
@@ -966,6 +977,9 @@ def test_standard_deviation04(xp):
966977 assert_almost_equal (output , xp .asarray (0.5 ), check_0d = False )
967978
968979
980+ # dask.array is maybe due to failed conversion to numpy?
981+ # array-api-strict should've caught use of non array API functions I think
982+ @skip_xp_backends ("dask.array" , reason = "conjugate called on dask.array which doesn't exist" )
969983def test_standard_deviation05 (xp ):
970984 labels = xp .asarray ([2 , 2 , 3 ])
971985 for type in types :
@@ -975,6 +989,7 @@ def test_standard_deviation05(xp):
975989 assert_almost_equal (output , xp .asarray (1.0 ), check_0d = False )
976990
977991
992+ @skip_xp_backends ("dask.array" , reason = "data-dependent output shapes" )
978993def test_standard_deviation06 (xp ):
979994 labels = xp .asarray ([2 , 2 , 3 , 3 , 4 ])
980995 with np .errstate (all = 'ignore' ):
@@ -987,6 +1002,7 @@ def test_standard_deviation06(xp):
9871002 assert_array_almost_equal (output , xp .asarray ([1.0 , 1.0 , 0.0 ]))
9881003
9891004
1005+ @skip_xp_backends ("dask.array" , reason = "data-dependent output shapes" )
9901006def test_standard_deviation07 (xp ):
9911007 labels = xp .asarray ([1 ])
9921008 with np .errstate (all = 'ignore' ):
@@ -1139,7 +1155,7 @@ def test_maximum_position06(xp):
11391155 assert output [0 ] == (0 , 0 )
11401156 assert output [1 ] == (1 , 1 )
11411157
1142-
1158+ @ skip_xp_backends ( "dask.array" , reason = "crash in dask.array searchsorted" )
11431159def test_maximum_position07 (xp ):
11441160 # Test float labels
11451161 if is_torch (xp ):
@@ -1157,6 +1173,7 @@ def test_maximum_position07(xp):
11571173 assert output [1 ] == (0 , 3 )
11581174
11591175
1176+ @skip_xp_backends ("dask.array" , reason = "dask wrong answer" )
11601177def test_extrema01 (xp ):
11611178 labels = np .asarray ([1 , 0 ], dtype = bool )
11621179 labels = xp .asarray (labels )
@@ -1173,6 +1190,7 @@ def test_extrema01(xp):
11731190 assert output1 == (output2 , output3 , output4 , output5 )
11741191
11751192
1193+ @skip_xp_backends ("dask.array" , reason = "dask wrong answer" )
11761194def test_extrema02 (xp ):
11771195 labels = xp .asarray ([1 , 2 ])
11781196 for type in types :
@@ -1297,6 +1315,7 @@ def test_center_of_mass06(xp):
12971315 assert output == expected
12981316
12991317
1318+ @skip_xp_backends ("dask.array" , reason = "wrong output shape" )
13001319def test_center_of_mass07 (xp ):
13011320 labels = xp .asarray ([1 , 0 ])
13021321 expected = (0.5 , 0.0 )
@@ -1306,6 +1325,7 @@ def test_center_of_mass07(xp):
13061325 assert output == expected
13071326
13081327
1328+ @skip_xp_backends ("dask.array" , reason = "wrong output shape" )
13091329def test_center_of_mass08 (xp ):
13101330 labels = xp .asarray ([1 , 2 ])
13111331 expected = (0.5 , 1.0 )
@@ -1315,6 +1335,7 @@ def test_center_of_mass08(xp):
13151335 assert output == expected
13161336
13171337
1338+ @skip_xp_backends ("dask.array" , reason = "data-dependent output shapes" )
13181339def test_center_of_mass09 (xp ):
13191340 labels = xp .asarray ((1 , 2 ))
13201341 expected = xp .asarray ([(0.5 , 0.0 ), (0.5 , 1.0 )], dtype = xp .float64 )
@@ -1352,6 +1373,7 @@ def test_histogram03(xp):
13521373 assert_array_almost_equal (output [1 ], expected2 )
13531374
13541375
1376+ @skip_xp_backends ("dask.array" , reason = "data-dependent output shapes" )
13551377def test_stat_funcs_2d (xp ):
13561378 a = xp .asarray ([[5 , 6 , 0 , 0 , 0 ], [8 , 9 , 0 , 0 , 0 ], [0 , 0 , 0 , 3 , 5 ]])
13571379 lbl = xp .asarray ([[1 , 1 , 0 , 0 , 0 ], [1 , 1 , 0 , 0 , 0 ], [0 , 0 , 0 , 2 , 2 ]])
0 commit comments