@@ -416,7 +416,7 @@ def test_complex(self, xp: ModuleType):
416416 expect = xp .asarray ([[1.0 , - 1.0j ], [1.0j , 1.0 ]], dtype = xp .complex128 )
417417 xp_assert_close (actual , expect )
418418
419- @pytest .mark .skip_xp_backend (Backend .SPARSE , reason = "matmul with nan fillvalue" )
419+ @pytest .mark .xfail_xp_backend (Backend .SPARSE , reason = "matmul with nan fillvalue" )
420420 def test_empty (self , xp : ModuleType ):
421421 with warnings .catch_warnings (record = True ):
422422 warnings .simplefilter ("always" , RuntimeWarning )
@@ -451,7 +451,7 @@ def test_xp(self, xp: ModuleType):
451451 )
452452
453453
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 )
455455class TestOneHot :
456456 @pytest .mark .parametrize ("n_dim" , range (4 ))
457457 @pytest .mark .parametrize ("num_classes" , [1 , 3 , 10 ])
@@ -816,7 +816,7 @@ def test_bool_dtype(self, xp: ModuleType):
816816 isclose (xp .asarray (True ), b , atol = 1 ), xp .asarray ([True , True , True ])
817817 )
818818
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" )
820820 @pytest .mark .skip_xp_backend (Backend .ARRAY_API_STRICTEST , reason = "unknown shape" )
821821 def test_none_shape (self , xp : ModuleType ):
822822 a = xp .asarray ([1 , 5 , 0 ])
@@ -825,7 +825,7 @@ def test_none_shape(self, xp: ModuleType):
825825 a = a [a < 5 ]
826826 xp_assert_equal (isclose (a , b ), xp .asarray ([True , False ]))
827827
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" )
829829 @pytest .mark .skip_xp_backend (Backend .ARRAY_API_STRICTEST , reason = "unknown shape" )
830830 def test_none_shape_bool (self , xp : ModuleType ):
831831 a = xp .asarray ([True , True , False ])
@@ -1141,10 +1141,10 @@ def test_xp(self, xp: ModuleType):
11411141
11421142
11431143class TestSinc :
1144- @pytest .mark .xfail_xp_backend (Backend .SPARSE , reason = "no linspace" )
11451144 def test_simple (self , xp : ModuleType ):
11461145 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 )
11481148 # check symmetry
11491149 xp_assert_close (w , xp .flip (w , axis = 0 ))
11501150
@@ -1153,11 +1153,12 @@ def test_dtype(self, xp: ModuleType, x: int | complex):
11531153 with pytest .raises (ValueError , match = "real floating data type" ):
11541154 _ = sinc (xp .asarray (x ))
11551155
1156- @pytest .mark .xfail_xp_backend (Backend .SPARSE , reason = "no arange" )
11571156 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 )
11611162 xp_assert_close (sinc (x ), expected , atol = 1e-15 )
11621163
11631164 def test_device (self , xp : ModuleType , device : Device ):
0 commit comments