@@ -149,14 +149,14 @@ def test_basic(self, xp):
149
149
150
150
151
151
def test_label01 (xp ):
152
- data = xp .ones ([] )
152
+ data = xp .ones (() )
153
153
out , n = ndimage .label (data )
154
154
assert out == 1
155
155
assert n == 1
156
156
157
157
158
158
def test_label02 (xp ):
159
- data = xp .zeros ([] )
159
+ data = xp .zeros (() )
160
160
out , n = ndimage .label (data )
161
161
assert out == 0
162
162
assert n == 0
@@ -557,6 +557,8 @@ def test_value_indices03(xp):
557
557
558
558
trueKeys = xp .unique_values (a )
559
559
vi = ndimage .value_indices (a )
560
+ # TODO: list(trueKeys) needs len of trueKeys
561
+ # (which is unknown for dask since it is the result of an unique call)
560
562
assert list (vi .keys ()) == list (trueKeys )
561
563
for k in [int (x ) for x in trueKeys ]:
562
564
trueNdx = xp .nonzero (a == k )
@@ -665,7 +667,6 @@ def test_sum11(xp):
665
667
assert_almost_equal (output , xp .asarray (6.0 ), check_0d = False )
666
668
667
669
668
- @skip_xp_backends ("dask.array" , reason = "data-dependent output shapes" )
669
670
def test_sum12 (xp ):
670
671
labels = xp .asarray ([[1 , 2 ], [2 , 4 ]], dtype = xp .int8 )
671
672
for type in types :
@@ -675,7 +676,6 @@ def test_sum12(xp):
675
676
assert_array_almost_equal (output , xp .asarray ([4.0 , 0.0 , 5.0 ]))
676
677
677
678
678
- @skip_xp_backends ("dask.array" , reason = "data-dependent output shapes" )
679
679
def test_sum_labels (xp ):
680
680
labels = xp .asarray ([[1 , 2 ], [2 , 4 ]], dtype = xp .int8 )
681
681
for type in types :
@@ -688,7 +688,6 @@ def test_sum_labels(xp):
688
688
assert xp .all (output_sum == output_labels )
689
689
assert_array_almost_equal (output_labels , xp .asarray ([4.0 , 0.0 , 5.0 ]))
690
690
691
- @xfail_xp_backends ("dask.array" , reason = "dask outputs wrong results here" )
692
691
def test_mean01 (xp ):
693
692
labels = np .asarray ([1 , 0 ], dtype = bool )
694
693
labels = xp .asarray (labels )
@@ -699,7 +698,6 @@ def test_mean01(xp):
699
698
assert_almost_equal (output , xp .asarray (2.0 ), check_0d = False )
700
699
701
700
702
- @xfail_xp_backends ("dask.array" , reason = "dask outputs wrong results here" )
703
701
def test_mean02 (xp ):
704
702
labels = np .asarray ([1 , 0 ], dtype = bool )
705
703
input = np .asarray ([[1 , 2 ], [3 , 4 ]], dtype = bool )
@@ -710,7 +708,6 @@ def test_mean02(xp):
710
708
assert_almost_equal (output , xp .asarray (1.0 ), check_0d = False )
711
709
712
710
713
- @xfail_xp_backends ("dask.array" , reason = "dask outputs wrong results here" )
714
711
def test_mean03 (xp ):
715
712
labels = xp .asarray ([1 , 2 ])
716
713
for type in types :
@@ -721,7 +718,6 @@ def test_mean03(xp):
721
718
assert_almost_equal (output , xp .asarray (3.0 ), check_0d = False )
722
719
723
720
724
- @xfail_xp_backends ("dask.array" , reason = "dask outputs wrong results here" )
725
721
def test_mean04 (xp ):
726
722
labels = xp .asarray ([[1 , 2 ], [2 , 4 ]], dtype = xp .int8 )
727
723
with np .errstate (all = 'ignore' ):
@@ -768,7 +764,6 @@ def test_minimum03(xp):
768
764
assert_almost_equal (output , xp .asarray (2.0 ), check_0d = False )
769
765
770
766
771
- @skip_xp_backends ('dask.array' , reason = "no argsort in Dask" )
772
767
def test_minimum04 (xp ):
773
768
labels = xp .asarray ([[1 , 2 ], [2 , 3 ]])
774
769
for type in types :
@@ -808,7 +803,6 @@ def test_maximum03(xp):
808
803
assert_almost_equal (output , xp .asarray (4.0 ), check_0d = False )
809
804
810
805
811
- @skip_xp_backends ('dask.array' , reason = "no argsort in Dask" )
812
806
def test_maximum04 (xp ):
813
807
labels = xp .asarray ([[1 , 2 ], [2 , 3 ]])
814
808
for type in types :
@@ -848,8 +842,6 @@ def test_median02(xp):
848
842
assert_almost_equal (output , xp .asarray (1.0 ), check_0d = False )
849
843
850
844
851
- @skip_xp_backends ("dask.array" ,
852
- reason = "dask.array.median only implemented for along an axis." )
853
845
def test_median03 (xp ):
854
846
a = xp .asarray ([[1 , 2 , 0 , 1 ],
855
847
[5 , 3 , 0 , 4 ],
@@ -863,15 +855,13 @@ def test_median03(xp):
863
855
assert_almost_equal (output , xp .asarray (3.0 ), check_0d = False )
864
856
865
857
866
- @xfail_xp_backends ("dask.array" , reason = "Crash inside dask searchsorted" )
867
858
def test_median_gh12836_bool (xp ):
868
859
# test boolean addition fix on example from gh-12836
869
860
a = np .asarray ([1 , 1 ], dtype = bool )
870
861
a = xp .asarray (a )
871
862
output = ndimage .median (a , labels = xp .ones ((2 ,)), index = xp .asarray ([1 ]))
872
863
assert_array_almost_equal (output , xp .asarray ([1.0 ]))
873
864
874
- @xfail_xp_backends ("dask.array" , reason = "Crash inside dask searchsorted" )
875
865
def test_median_no_int_overflow (xp ):
876
866
# test integer overflow fix on example from gh-12836
877
867
a = xp .asarray ([65 , 70 ], dtype = xp .int8 )
@@ -912,10 +902,6 @@ def test_variance04(xp):
912
902
output = ndimage .variance (input )
913
903
assert_almost_equal (output , xp .asarray (0.25 ), check_0d = False )
914
904
915
- # dask.array is maybe due to failed conversion to numpy?
916
- # array-api-strict should've caught use of non array API functions I think
917
- @skip_xp_backends ("dask.array" ,
918
- reason = "conjugate called on dask.array which doesn't exist" )
919
905
def test_variance05 (xp ):
920
906
labels = xp .asarray ([2 , 2 , 3 ])
921
907
for type in types :
@@ -925,7 +911,6 @@ def test_variance05(xp):
925
911
output = ndimage .variance (input , labels , 2 )
926
912
assert_almost_equal (output , xp .asarray (1.0 ), check_0d = False )
927
913
928
- @skip_xp_backends ("dask.array" , reason = "Data-dependent output shapes" )
929
914
def test_variance06 (xp ):
930
915
labels = xp .asarray ([2 , 2 , 3 , 3 , 4 ])
931
916
with np .errstate (all = 'ignore' ):
@@ -970,10 +955,6 @@ def test_standard_deviation04(xp):
970
955
assert_almost_equal (output , xp .asarray (0.5 ), check_0d = False )
971
956
972
957
973
- # dask.array is maybe due to failed conversion to numpy?
974
- # array-api-strict should've caught use of non array API functions I think
975
- @skip_xp_backends ("dask.array" ,
976
- reason = "conjugate called on dask.array which doesn't exist" )
977
958
def test_standard_deviation05 (xp ):
978
959
labels = xp .asarray ([2 , 2 , 3 ])
979
960
for type in types :
@@ -983,7 +964,6 @@ def test_standard_deviation05(xp):
983
964
assert_almost_equal (output , xp .asarray (1.0 ), check_0d = False )
984
965
985
966
986
- @skip_xp_backends ("dask.array" , reason = "data-dependent output shapes" )
987
967
def test_standard_deviation06 (xp ):
988
968
labels = xp .asarray ([2 , 2 , 3 , 3 , 4 ])
989
969
with np .errstate (all = 'ignore' ):
@@ -996,7 +976,6 @@ def test_standard_deviation06(xp):
996
976
assert_array_almost_equal (output , xp .asarray ([1.0 , 1.0 , 0.0 ]))
997
977
998
978
999
- @skip_xp_backends ("dask.array" , reason = "data-dependent output shapes" )
1000
979
def test_standard_deviation07 (xp ):
1001
980
labels = xp .asarray ([1 ])
1002
981
with np .errstate (all = 'ignore' ):
@@ -1070,7 +1049,6 @@ def test_minimum_position06(xp):
1070
1049
assert output == (0 , 1 )
1071
1050
1072
1051
1073
- @skip_xp_backends ('dask.array' , reason = "no argsort in Dask" )
1074
1052
def test_minimum_position07 (xp ):
1075
1053
labels = xp .asarray ([1 , 2 , 3 , 4 ])
1076
1054
for type in types :
@@ -1136,7 +1114,6 @@ def test_maximum_position05(xp):
1136
1114
assert output == (0 , 0 )
1137
1115
1138
1116
1139
- @skip_xp_backends ('dask.array' , reason = "no argsort in Dask" )
1140
1117
def test_maximum_position06 (xp ):
1141
1118
labels = xp .asarray ([1 , 2 , 0 , 4 ])
1142
1119
for type in types :
@@ -1149,7 +1126,6 @@ def test_maximum_position06(xp):
1149
1126
assert output [0 ] == (0 , 0 )
1150
1127
assert output [1 ] == (1 , 1 )
1151
1128
1152
- @xfail_xp_backends ("dask.array" , reason = "crash in dask.array searchsorted" )
1153
1129
@xfail_xp_backends ("torch" , reason = "output[1] is wrong on pytorch" )
1154
1130
def test_maximum_position07 (xp ):
1155
1131
# Test float labels
@@ -1165,7 +1141,6 @@ def test_maximum_position07(xp):
1165
1141
assert output [1 ] == (0 , 3 )
1166
1142
1167
1143
1168
- @xfail_xp_backends ("dask.array" , reason = "dask wrong answer" )
1169
1144
def test_extrema01 (xp ):
1170
1145
labels = np .asarray ([1 , 0 ], dtype = bool )
1171
1146
labels = xp .asarray (labels )
@@ -1182,7 +1157,6 @@ def test_extrema01(xp):
1182
1157
assert output1 == (output2 , output3 , output4 , output5 )
1183
1158
1184
1159
1185
- @xfail_xp_backends ("dask.array" , reason = "dask wrong answer" )
1186
1160
def test_extrema02 (xp ):
1187
1161
labels = xp .asarray ([1 , 2 ])
1188
1162
for type in types :
@@ -1201,7 +1175,6 @@ def test_extrema02(xp):
1201
1175
assert output1 == (output2 , output3 , output4 , output5 )
1202
1176
1203
1177
1204
- @skip_xp_backends ('dask.array' , reason = "no argsort in Dask" )
1205
1178
def test_extrema03 (xp ):
1206
1179
labels = xp .asarray ([[1 , 2 ], [2 , 3 ]])
1207
1180
for type in types :
@@ -1230,7 +1203,6 @@ def test_extrema03(xp):
1230
1203
assert output1 [3 ] == output5
1231
1204
1232
1205
1233
- @skip_xp_backends ('dask.array' , reason = "no argsort in Dask" )
1234
1206
def test_extrema04 (xp ):
1235
1207
labels = xp .asarray ([1 , 2 , 0 , 4 ])
1236
1208
for type in types :
@@ -1307,7 +1279,6 @@ def test_center_of_mass06(xp):
1307
1279
assert output == expected
1308
1280
1309
1281
1310
- @xfail_xp_backends ("dask.array" , reason = "wrong output shape" )
1311
1282
def test_center_of_mass07 (xp ):
1312
1283
labels = xp .asarray ([1 , 0 ])
1313
1284
expected = (0.5 , 0.0 )
@@ -1317,7 +1288,6 @@ def test_center_of_mass07(xp):
1317
1288
assert output == expected
1318
1289
1319
1290
1320
- @xfail_xp_backends ("dask.array" , reason = "wrong output shape" )
1321
1291
def test_center_of_mass08 (xp ):
1322
1292
labels = xp .asarray ([1 , 2 ])
1323
1293
expected = (0.5 , 1.0 )
@@ -1327,7 +1297,6 @@ def test_center_of_mass08(xp):
1327
1297
assert output == expected
1328
1298
1329
1299
1330
- @skip_xp_backends ("dask.array" , reason = "data-dependent output shapes" )
1331
1300
def test_center_of_mass09 (xp ):
1332
1301
labels = xp .asarray ((1 , 2 ))
1333
1302
expected = xp .asarray ([(0.5 , 0.0 ), (0.5 , 1.0 )], dtype = xp .float64 )
@@ -1365,7 +1334,6 @@ def test_histogram03(xp):
1365
1334
assert_array_almost_equal (output [1 ], expected2 )
1366
1335
1367
1336
1368
- @skip_xp_backends ("dask.array" , reason = "data-dependent output shapes" )
1369
1337
def test_stat_funcs_2d (xp ):
1370
1338
a = xp .asarray ([[5 , 6 , 0 , 0 , 0 ], [8 , 9 , 0 , 0 , 0 ], [0 , 0 , 0 , 3 , 5 ]])
1371
1339
lbl = xp .asarray ([[1 , 1 , 0 , 0 , 0 ], [1 , 1 , 0 , 0 , 0 ], [0 , 0 , 0 , 2 , 2 ]])
0 commit comments