@@ -416,7 +416,7 @@ def test_complex(self, xp: ModuleType):
416
416
expect = xp .asarray ([[1.0 , - 1.0j ], [1.0j , 1.0 ]], dtype = xp .complex128 )
417
417
xp_assert_close (actual , expect )
418
418
419
- @pytest .mark .skip_xp_backend (Backend .SPARSE , reason = "matmul with nan fillvalue " )
419
+ @pytest .mark .xfail_xp_backend (Backend .SPARSE , reason = "sparse#877 " )
420
420
def test_empty (self , xp : ModuleType ):
421
421
with warnings .catch_warnings (record = True ):
422
422
warnings .simplefilter ("always" , RuntimeWarning )
@@ -451,7 +451,7 @@ def test_xp(self, xp: ModuleType):
451
451
)
452
452
453
453
454
- @pytest .mark .skip_xp_backend (Backend .SPARSE , reason = "backend doesn't have arange" )
454
+ @pytest .mark .xfail_xp_backend (Backend .SPARSE , reason = "no arange" , strict = False )
455
455
class TestOneHot :
456
456
@pytest .mark .parametrize ("n_dim" , range (4 ))
457
457
@pytest .mark .parametrize ("num_classes" , [1 , 3 , 10 ])
@@ -816,7 +816,7 @@ def test_bool_dtype(self, xp: ModuleType):
816
816
isclose (xp .asarray (True ), b , atol = 1 ), xp .asarray ([True , True , True ])
817
817
)
818
818
819
- @pytest .mark .xfail_xp_backend (Backend .SPARSE , reason = "index by sparse array" )
819
+ @pytest .mark .skip_xp_backend (Backend .SPARSE , reason = "index by sparse array" )
820
820
@pytest .mark .skip_xp_backend (Backend .ARRAY_API_STRICTEST , reason = "unknown shape" )
821
821
def test_none_shape (self , xp : ModuleType ):
822
822
a = xp .asarray ([1 , 5 , 0 ])
@@ -825,7 +825,7 @@ def test_none_shape(self, xp: ModuleType):
825
825
a = a [a < 5 ]
826
826
xp_assert_equal (isclose (a , b ), xp .asarray ([True , False ]))
827
827
828
- @pytest .mark .xfail_xp_backend (Backend .SPARSE , reason = "index by sparse array" )
828
+ @pytest .mark .skip_xp_backend (Backend .SPARSE , reason = "index by sparse array" )
829
829
@pytest .mark .skip_xp_backend (Backend .ARRAY_API_STRICTEST , reason = "unknown shape" )
830
830
def test_none_shape_bool (self , xp : ModuleType ):
831
831
a = xp .asarray ([True , True , False ])
@@ -1141,10 +1141,10 @@ def test_xp(self, xp: ModuleType):
1141
1141
1142
1142
1143
1143
class TestSinc :
1144
- @pytest .mark .xfail_xp_backend (Backend .SPARSE , reason = "no linspace" )
1145
1144
def test_simple (self , xp : ModuleType ):
1146
1145
xp_assert_equal (sinc (xp .asarray (0.0 )), xp .asarray (1.0 ))
1147
- w = sinc (xp .linspace (- 1 , 1 , 100 ))
1146
+ x = xp .asarray (np .linspace (- 1 , 1 , 100 ))
1147
+ w = sinc (x )
1148
1148
# check symmetry
1149
1149
xp_assert_close (w , xp .flip (w , axis = 0 ))
1150
1150
@@ -1153,11 +1153,12 @@ def test_dtype(self, xp: ModuleType, x: int | complex):
1153
1153
with pytest .raises (ValueError , match = "real floating data type" ):
1154
1154
_ = sinc (xp .asarray (x ))
1155
1155
1156
- @pytest .mark .xfail_xp_backend (Backend .SPARSE , reason = "no arange" )
1157
1156
def test_3d (self , xp : ModuleType ):
1158
- x = xp .reshape (xp .arange (18 , dtype = xp .float64 ), (3 , 3 , 2 ))
1159
- expected = xp .zeros ((3 , 3 , 2 ), dtype = xp .float64 )
1160
- expected = at (expected )[0 , 0 , 0 ].set (1.0 )
1157
+ x = np .arange (18 , dtype = np .float64 ).reshape ((3 , 3 , 2 ))
1158
+ expected = np .zeros_like (x )
1159
+ expected [0 , 0 , 0 ] = 1
1160
+ x = xp .asarray (x )
1161
+ expected = xp .asarray (expected )
1161
1162
xp_assert_close (sinc (x ), expected , atol = 1e-15 )
1162
1163
1163
1164
def test_device (self , xp : ModuleType , device : Device ):
0 commit comments