@@ -38,12 +38,7 @@ def test_device(self, xp: ModuleType, device: Device):
38
38
39
39
40
40
class TestAssertEqualCloseLess :
41
- pr_assert_close = pytest .param ( # pyright: ignore[reportUnannotatedClassAttribute]
42
- xp_assert_close ,
43
- marks = pytest .mark .xfail_xp_backend (Backend .SPARSE , reason = "no isdtype" ),
44
- )
45
-
46
- @pytest .mark .parametrize ("func" , [xp_assert_equal , pr_assert_close ])
41
+ @pytest .mark .parametrize ("func" , [xp_assert_equal , xp_assert_close ])
47
42
def test_assert_equal_close_basic (self , xp : ModuleType , func : Callable [..., None ]):
48
43
func (xp .asarray (0 ), xp .asarray (0 ))
49
44
func (xp .asarray ([1 , 2 ]), xp .asarray ([1 , 2 ]))
@@ -75,7 +70,7 @@ def test_namespace(self, xp: ModuleType, func: Callable[..., None]):
75
70
with pytest .raises (TypeError , match = "list is not a supported array type" ):
76
71
func (xp .asarray ([0 ]), [0 ])
77
72
78
- @pytest .mark .parametrize ("func" , [xp_assert_equal , pr_assert_close , xp_assert_less ])
73
+ @pytest .mark .parametrize ("func" , [xp_assert_equal , xp_assert_close , xp_assert_less ])
79
74
def test_check_shape (self , xp : ModuleType , func : Callable [..., None ]):
80
75
a = xp .asarray ([1 ] if func is xp_assert_less else [2 ])
81
76
b = xp .asarray (2 )
@@ -90,7 +85,7 @@ def test_check_shape(self, xp: ModuleType, func: Callable[..., None]):
90
85
with pytest .raises (AssertionError , match = "sizes do not match" ):
91
86
func (a , d , check_shape = False )
92
87
93
- @pytest .mark .parametrize ("func" , [xp_assert_equal , pr_assert_close , xp_assert_less ])
88
+ @pytest .mark .parametrize ("func" , [xp_assert_equal , xp_assert_close , xp_assert_less ])
94
89
def test_check_dtype (self , xp : ModuleType , func : Callable [..., None ]):
95
90
a = xp .asarray (1 if func is xp_assert_less else 2 )
96
91
b = xp .asarray (2 , dtype = xp .int16 )
@@ -102,7 +97,7 @@ def test_check_dtype(self, xp: ModuleType, func: Callable[..., None]):
102
97
with pytest .raises (AssertionError , match = "Mismatched elements" ):
103
98
func (a , c , check_dtype = False )
104
99
105
- @pytest .mark .parametrize ("func" , [xp_assert_equal , pr_assert_close , xp_assert_less ])
100
+ @pytest .mark .parametrize ("func" , [xp_assert_equal , xp_assert_close , xp_assert_less ])
106
101
@pytest .mark .xfail_xp_backend (
107
102
Backend .SPARSE , reason = "sparse [()] returns np.generic"
108
103
)
@@ -122,7 +117,6 @@ def test_check_scalar(
122
117
with pytest .raises (AssertionError , match = "Mismatched elements" ):
123
118
func (a , c , check_scalar = True )
124
119
125
- @pytest .mark .xfail_xp_backend (Backend .SPARSE , reason = "no isdtype" )
126
120
@pytest .mark .parametrize ("dtype" , ["int64" , "float64" ])
127
121
def test_assert_close_tolerance (self , dtype : str , xp : ModuleType ):
128
122
a = xp .asarray ([100 ], dtype = getattr (xp , dtype ))
@@ -145,7 +139,7 @@ def test_assert_less(self, xp: ModuleType):
145
139
with pytest .raises (AssertionError , match = "Mismatched elements" ):
146
140
xp_assert_less (xp .asarray ([1 , 1 ]), xp .asarray ([2 , 1 ]))
147
141
148
- @pytest .mark .parametrize ("func" , [xp_assert_equal , pr_assert_close , xp_assert_less ])
142
+ @pytest .mark .parametrize ("func" , [xp_assert_equal , xp_assert_close , xp_assert_less ])
149
143
@pytest .mark .xfail_xp_backend (Backend .SPARSE , reason = "index by sparse array" )
150
144
@pytest .mark .skip_xp_backend (Backend .ARRAY_API_STRICTEST , reason = "boolean indexing" )
151
145
def test_none_shape (self , xp : ModuleType , func : Callable [..., None ]):
@@ -176,7 +170,7 @@ def test_none_shape(self, xp: ModuleType, func: Callable[..., None]):
176
170
with pytest .raises (AssertionError , match = "Mismatched elements" ):
177
171
func (xp .asarray ([4 ]), a )
178
172
179
- @pytest .mark .parametrize ("func" , [xp_assert_equal , pr_assert_close , xp_assert_less ])
173
+ @pytest .mark .parametrize ("func" , [xp_assert_equal , xp_assert_close , xp_assert_less ])
180
174
def test_device (self , xp : ModuleType , device : Device , func : Callable [..., None ]):
181
175
a = xp .asarray ([1 ] if func is xp_assert_less else [2 ], device = device )
182
176
b = xp .asarray ([2 ], device = device )
0 commit comments