@@ -416,6 +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
420
def test_empty (self , xp : ModuleType ):
420
421
with warnings .catch_warnings (record = True ):
421
422
warnings .simplefilter ("always" , RuntimeWarning )
@@ -611,7 +612,6 @@ def test_xp(self, xp: ModuleType):
611
612
xp_assert_equal (y , xp .asarray ([[1 , 0 ], [0 , 2 ]]))
612
613
613
614
614
- @pytest .mark .xfail_xp_backend (Backend .SPARSE , reason = "no __array_namespace_info__" )
615
615
class TestDefaultDType :
616
616
def test_basic (self , xp : ModuleType ):
617
617
assert default_dtype (xp ) == xp .empty (0 ).dtype
@@ -696,6 +696,9 @@ def test_xp(self, xp: ModuleType):
696
696
@pytest .mark .filterwarnings ( # array_api_strictest
697
697
"ignore:invalid value encountered:RuntimeWarning:array_api_strict"
698
698
)
699
+ @pytest .mark .filterwarnings ( # sparse
700
+ "ignore:invalid value encountered:RuntimeWarning:sparse"
701
+ )
699
702
class TestIsClose :
700
703
@pytest .mark .parametrize ("swap" , [False , True ])
701
704
@pytest .mark .parametrize (
@@ -813,6 +816,7 @@ def test_bool_dtype(self, xp: ModuleType):
813
816
isclose (xp .asarray (True ), b , atol = 1 ), xp .asarray ([True , True , True ])
814
817
)
815
818
819
+ @pytest .mark .xfail_xp_backend (Backend .SPARSE , reason = "index by sparse array" )
816
820
@pytest .mark .skip_xp_backend (Backend .ARRAY_API_STRICTEST , reason = "unknown shape" )
817
821
def test_none_shape (self , xp : ModuleType ):
818
822
a = xp .asarray ([1 , 5 , 0 ])
@@ -821,6 +825,7 @@ def test_none_shape(self, xp: ModuleType):
821
825
a = a [a < 5 ]
822
826
xp_assert_equal (isclose (a , b ), xp .asarray ([True , False ]))
823
827
828
+ @pytest .mark .xfail_xp_backend (Backend .SPARSE , reason = "index by sparse array" )
824
829
@pytest .mark .skip_xp_backend (Backend .ARRAY_API_STRICTEST , reason = "unknown shape" )
825
830
def test_none_shape_bool (self , xp : ModuleType ):
826
831
a = xp .asarray ([True , True , False ])
@@ -1136,6 +1141,7 @@ def test_xp(self, xp: ModuleType):
1136
1141
1137
1142
1138
1143
class TestSinc :
1144
+ @pytest .mark .xfail_xp_backend (Backend .SPARSE , reason = "no linspace" )
1139
1145
def test_simple (self , xp : ModuleType ):
1140
1146
xp_assert_equal (sinc (xp .asarray (0.0 )), xp .asarray (1.0 ))
1141
1147
w = sinc (xp .linspace (- 1 , 1 , 100 ))
@@ -1147,6 +1153,7 @@ def test_dtype(self, xp: ModuleType, x: int | complex):
1147
1153
with pytest .raises (ValueError , match = "real floating data type" ):
1148
1154
_ = sinc (xp .asarray (x ))
1149
1155
1156
+ @pytest .mark .xfail_xp_backend (Backend .SPARSE , reason = "no arange" )
1150
1157
def test_3d (self , xp : ModuleType ):
1151
1158
x = xp .reshape (xp .arange (18 , dtype = xp .float64 ), (3 , 3 , 2 ))
1152
1159
expected = xp .zeros ((3 , 3 , 2 ), dtype = xp .float64 )
0 commit comments