Skip to content

Commit 97a7e31

Browse files
committed
Do not allow choose tests to fallback to NumPy
1 parent 797c86b commit 97a7e31

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

dpnp/tests/test_indexing.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,6 @@ def test_mode_clip(self):
865865
assert (result == dpnp.array([-2, 0, -2, 2])).all()
866866

867867

868-
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
869868
def test_choose():
870869
a = numpy.r_[:4]
871870
ia = dpnp.array(a)
@@ -874,8 +873,10 @@ def test_choose():
874873
c = numpy.r_[100:500:100]
875874
ic = dpnp.array(c)
876875

877-
expected = numpy.choose([0, 0, 0, 0], [a, b, c])
878-
result = dpnp.choose([0, 0, 0, 0], [ia, ib, ic])
876+
inds_np = numpy.zeros(4, dtype="i4")
877+
inds = dpnp.zeros(4, dtype="i4")
878+
expected = numpy.choose(inds_np, [a, b, c])
879+
result = dpnp.choose(inds, [ia, ib, ic])
879880
assert_array_equal(expected, result)
880881

881882

dpnp/tests/third_party/cupy/indexing_tests/test_indexing.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,39 +206,34 @@ def test_choose(self, xp, dtype):
206206
c = testing.shaped_arange((3, 4), xp, dtype)
207207
return a.choose(c)
208208

209-
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
210209
@testing.for_all_dtypes()
211210
@testing.numpy_cupy_array_equal()
212211
def test_choose_broadcast(self, xp, dtype):
213212
a = xp.array([[1, 0, 1], [0, 1, 0], [1, 0, 1]])
214213
c = xp.array([-10, 10]).astype(dtype)
215214
return a.choose(c)
216215

217-
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
218216
@testing.for_all_dtypes()
219217
@testing.numpy_cupy_array_equal()
220218
def test_choose_broadcast2(self, xp, dtype):
221219
a = xp.array([0, 1])
222220
c = testing.shaped_arange((3, 5, 2), xp, dtype)
223221
return a.choose(c)
224222

225-
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
226223
@testing.for_all_dtypes()
227224
@testing.numpy_cupy_array_equal()
228225
def test_choose_wrap(self, xp, dtype):
229226
a = xp.array([0, 3, -1, 5])
230227
c = testing.shaped_arange((3, 4), xp, dtype)
231228
return a.choose(c, mode="wrap")
232229

233-
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
234230
@testing.for_all_dtypes()
235231
@testing.numpy_cupy_array_equal()
236232
def test_choose_clip(self, xp, dtype):
237233
a = xp.array([0, 3, -1, 5])
238234
c = testing.shaped_arange((3, 4), xp, dtype)
239235
return a.choose(c, mode="clip")
240236

241-
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
242237
@testing.with_requires("numpy>=1.19")
243238
def test_unknown_clip(self):
244239
for xp in (numpy, cupy):
@@ -247,14 +242,13 @@ def test_unknown_clip(self):
247242
with pytest.raises(ValueError):
248243
a.choose(c, mode="unknown")
249244

250-
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
245+
@pytest.mark.skip("`raise` keyword not implemented")
251246
def test_raise(self):
252247
a = cupy.array([2])
253248
c = cupy.array([[0, 1]])
254249
with self.assertRaises(ValueError):
255250
a.choose(c)
256251

257-
@pytest.mark.usefixtures("allow_fall_back_on_numpy")
258252
@testing.for_all_dtypes()
259253
def test_choose_broadcast_fail(self, dtype):
260254
for xp in (numpy, cupy):

0 commit comments

Comments
 (0)