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