@@ -365,7 +365,7 @@ def test_label_output_dtype(xp):
365
365
assert output .dtype == t
366
366
367
367
368
- @xfail_xp_backends ('dask.array' , reason = 'Dask does not raise' )
368
+ @skip_xp_backends ('dask.array' , reason = 'Dask does not raise' )
369
369
@xfail_xp_backends ('jax.numpy' , reason = 'JAX does not raise' )
370
370
def test_label_output_wrong_size (xp ):
371
371
data = xp .ones ([5 ])
@@ -554,6 +554,7 @@ def test_value_indices02(xp):
554
554
ndimage .value_indices (data )
555
555
556
556
557
+ @skip_xp_backends ("dask.array" , reason = "len on data-dependent output shapes" )
557
558
def test_value_indices03 (xp ):
558
559
"Test different input array shapes, from 1-D to 4-D"
559
560
for shape in [(36 ,), (18 , 2 ), (3 , 3 , 4 ), (3 , 3 , 2 , 2 )]:
@@ -673,6 +674,7 @@ def test_sum11(xp):
673
674
assert_almost_equal (output , xp .asarray (6.0 ), check_0d = False )
674
675
675
676
677
+ @skip_xp_backends ("dask.array" , reason = "data-dependent output shapes" )
676
678
def test_sum12 (xp ):
677
679
labels = xp .asarray ([[1 , 2 ], [2 , 4 ]], dtype = xp .int8 )
678
680
for type in types :
@@ -682,6 +684,7 @@ def test_sum12(xp):
682
684
assert_array_almost_equal (output , xp .asarray ([4.0 , 0.0 , 5.0 ]))
683
685
684
686
687
+ @skip_xp_backends ("dask.array" , reason = "data-dependent output shapes" )
685
688
def test_sum_labels (xp ):
686
689
labels = xp .asarray ([[1 , 2 ], [2 , 4 ]], dtype = xp .int8 )
687
690
for type in types :
@@ -694,7 +697,7 @@ def test_sum_labels(xp):
694
697
assert xp .all (output_sum == output_labels )
695
698
assert_array_almost_equal (output_labels , xp .asarray ([4.0 , 0.0 , 5.0 ]))
696
699
697
-
700
+ @ skip_xp_backends ( "dask.array" , reason = "dask outputs wrong results here" )
698
701
def test_mean01 (xp ):
699
702
labels = np .asarray ([1 , 0 ], dtype = bool )
700
703
labels = xp .asarray (labels )
@@ -705,6 +708,7 @@ def test_mean01(xp):
705
708
assert_almost_equal (output , xp .asarray (2.0 ), check_0d = False )
706
709
707
710
711
+ @skip_xp_backends ("dask.array" , reason = "dask outputs wrong results here" )
708
712
def test_mean02 (xp ):
709
713
labels = np .asarray ([1 , 0 ], dtype = bool )
710
714
input = np .asarray ([[1 , 2 ], [3 , 4 ]], dtype = bool )
@@ -715,6 +719,7 @@ def test_mean02(xp):
715
719
assert_almost_equal (output , xp .asarray (1.0 ), check_0d = False )
716
720
717
721
722
+ @skip_xp_backends ("dask.array" , reason = "dask outputs wrong results here" )
718
723
def test_mean03 (xp ):
719
724
labels = xp .asarray ([1 , 2 ])
720
725
for type in types :
@@ -725,6 +730,7 @@ def test_mean03(xp):
725
730
assert_almost_equal (output , xp .asarray (3.0 ), check_0d = False )
726
731
727
732
733
+ @skip_xp_backends ("dask.array" , reason = "dask outputs wrong results here" )
728
734
def test_mean04 (xp ):
729
735
labels = xp .asarray ([[1 , 2 ], [2 , 4 ]], dtype = xp .int8 )
730
736
with np .errstate (all = 'ignore' ):
@@ -828,6 +834,7 @@ def test_maximum05(xp):
828
834
assert ndimage .maximum (x ) == - 1
829
835
830
836
837
+ @pytest .mark .filterwarnings ("ignore::FutureWarning:dask" )
831
838
def test_median01 (xp ):
832
839
a = xp .asarray ([[1 , 2 , 0 , 1 ],
833
840
[5 , 3 , 0 , 4 ],
@@ -850,6 +857,7 @@ def test_median02(xp):
850
857
assert_almost_equal (output , xp .asarray (1.0 ), check_0d = False )
851
858
852
859
860
+ @skip_xp_backends ("dask.array" , reason = "dask.array.median only implemented for along an axis." )
853
861
def test_median03 (xp ):
854
862
a = xp .asarray ([[1 , 2 , 0 , 1 ],
855
863
[5 , 3 , 0 , 4 ],
@@ -863,14 +871,15 @@ def test_median03(xp):
863
871
assert_almost_equal (output , xp .asarray (3.0 ), check_0d = False )
864
872
865
873
874
+ @skip_xp_backends ("dask.array" , reason = "Crash inside dask searchsorted" )
866
875
def test_median_gh12836_bool (xp ):
867
876
# test boolean addition fix on example from gh-12836
868
877
a = np .asarray ([1 , 1 ], dtype = bool )
869
878
a = xp .asarray (a )
870
879
output = ndimage .median (a , labels = xp .ones ((2 ,)), index = xp .asarray ([1 ]))
871
880
assert_array_almost_equal (output , xp .asarray ([1.0 ]))
872
881
873
-
882
+ @ skip_xp_backends ( "dask.array" , reason = "Crash inside dask searchsorted" )
874
883
def test_median_no_int_overflow (xp ):
875
884
# test integer overflow fix on example from gh-12836
876
885
a = xp .asarray ([65 , 70 ], dtype = xp .int8 )
@@ -911,7 +920,9 @@ def test_variance04(xp):
911
920
output = ndimage .variance (input )
912
921
assert_almost_equal (output , xp .asarray (0.25 ), check_0d = False )
913
922
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" )
915
926
def test_variance05 (xp ):
916
927
labels = xp .asarray ([2 , 2 , 3 ])
917
928
for type in types :
@@ -921,7 +932,7 @@ def test_variance05(xp):
921
932
output = ndimage .variance (input , labels , 2 )
922
933
assert_almost_equal (output , xp .asarray (1.0 ), check_0d = False )
923
934
924
-
935
+ @ skip_xp_backends ( "dask.array" , reason = "Data-dependent output shapes" )
925
936
def test_variance06 (xp ):
926
937
labels = xp .asarray ([2 , 2 , 3 , 3 , 4 ])
927
938
with np .errstate (all = 'ignore' ):
@@ -966,6 +977,9 @@ def test_standard_deviation04(xp):
966
977
assert_almost_equal (output , xp .asarray (0.5 ), check_0d = False )
967
978
968
979
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" )
969
983
def test_standard_deviation05 (xp ):
970
984
labels = xp .asarray ([2 , 2 , 3 ])
971
985
for type in types :
@@ -975,6 +989,7 @@ def test_standard_deviation05(xp):
975
989
assert_almost_equal (output , xp .asarray (1.0 ), check_0d = False )
976
990
977
991
992
+ @skip_xp_backends ("dask.array" , reason = "data-dependent output shapes" )
978
993
def test_standard_deviation06 (xp ):
979
994
labels = xp .asarray ([2 , 2 , 3 , 3 , 4 ])
980
995
with np .errstate (all = 'ignore' ):
@@ -987,6 +1002,7 @@ def test_standard_deviation06(xp):
987
1002
assert_array_almost_equal (output , xp .asarray ([1.0 , 1.0 , 0.0 ]))
988
1003
989
1004
1005
+ @skip_xp_backends ("dask.array" , reason = "data-dependent output shapes" )
990
1006
def test_standard_deviation07 (xp ):
991
1007
labels = xp .asarray ([1 ])
992
1008
with np .errstate (all = 'ignore' ):
@@ -1139,7 +1155,7 @@ def test_maximum_position06(xp):
1139
1155
assert output [0 ] == (0 , 0 )
1140
1156
assert output [1 ] == (1 , 1 )
1141
1157
1142
-
1158
+ @ skip_xp_backends ( "dask.array" , reason = "crash in dask.array searchsorted" )
1143
1159
def test_maximum_position07 (xp ):
1144
1160
# Test float labels
1145
1161
if is_torch (xp ):
@@ -1157,6 +1173,7 @@ def test_maximum_position07(xp):
1157
1173
assert output [1 ] == (0 , 3 )
1158
1174
1159
1175
1176
+ @skip_xp_backends ("dask.array" , reason = "dask wrong answer" )
1160
1177
def test_extrema01 (xp ):
1161
1178
labels = np .asarray ([1 , 0 ], dtype = bool )
1162
1179
labels = xp .asarray (labels )
@@ -1173,6 +1190,7 @@ def test_extrema01(xp):
1173
1190
assert output1 == (output2 , output3 , output4 , output5 )
1174
1191
1175
1192
1193
+ @skip_xp_backends ("dask.array" , reason = "dask wrong answer" )
1176
1194
def test_extrema02 (xp ):
1177
1195
labels = xp .asarray ([1 , 2 ])
1178
1196
for type in types :
@@ -1297,6 +1315,7 @@ def test_center_of_mass06(xp):
1297
1315
assert output == expected
1298
1316
1299
1317
1318
+ @skip_xp_backends ("dask.array" , reason = "wrong output shape" )
1300
1319
def test_center_of_mass07 (xp ):
1301
1320
labels = xp .asarray ([1 , 0 ])
1302
1321
expected = (0.5 , 0.0 )
@@ -1306,6 +1325,7 @@ def test_center_of_mass07(xp):
1306
1325
assert output == expected
1307
1326
1308
1327
1328
+ @skip_xp_backends ("dask.array" , reason = "wrong output shape" )
1309
1329
def test_center_of_mass08 (xp ):
1310
1330
labels = xp .asarray ([1 , 2 ])
1311
1331
expected = (0.5 , 1.0 )
@@ -1315,6 +1335,7 @@ def test_center_of_mass08(xp):
1315
1335
assert output == expected
1316
1336
1317
1337
1338
+ @skip_xp_backends ("dask.array" , reason = "data-dependent output shapes" )
1318
1339
def test_center_of_mass09 (xp ):
1319
1340
labels = xp .asarray ((1 , 2 ))
1320
1341
expected = xp .asarray ([(0.5 , 0.0 ), (0.5 , 1.0 )], dtype = xp .float64 )
@@ -1352,6 +1373,7 @@ def test_histogram03(xp):
1352
1373
assert_array_almost_equal (output [1 ], expected2 )
1353
1374
1354
1375
1376
+ @skip_xp_backends ("dask.array" , reason = "data-dependent output shapes" )
1355
1377
def test_stat_funcs_2d (xp ):
1356
1378
a = xp .asarray ([[5 , 6 , 0 , 0 , 0 ], [8 , 9 , 0 , 0 , 0 ], [0 , 0 , 0 , 3 , 5 ]])
1357
1379
lbl = xp .asarray ([[1 , 1 , 0 , 0 , 0 ], [1 , 1 , 0 , 0 , 0 ], [0 , 0 , 0 , 2 , 2 ]])
0 commit comments