Skip to content

Commit 3215c9f

Browse files
committed
More PR review changes
1 parent 16a71c3 commit 3215c9f

File tree

1 file changed

+14
-51
lines changed

1 file changed

+14
-51
lines changed

dpctl/tests/test_tensor_diff.py

Lines changed: 14 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,7 @@ def test_diff_wrong_append_prepend_shape():
247247

248248
assert_raises_regex(
249249
ValueError,
250-
"`diff` argument `prepend` with shape.*is invalid"
251-
" for first input with shape.*",
250+
".*shape.*is invalid.*",
252251
dpt.diff,
253252
arr,
254253
prepend=arr_bad_sh,
@@ -257,8 +256,7 @@ def test_diff_wrong_append_prepend_shape():
257256

258257
assert_raises_regex(
259258
ValueError,
260-
"`diff` argument `append` with shape.*is invalid"
261-
" for first input with shape.*",
259+
".*shape.*is invalid.*",
262260
dpt.diff,
263261
arr,
264262
prepend=arr,
@@ -267,17 +265,15 @@ def test_diff_wrong_append_prepend_shape():
267265

268266
assert_raises_regex(
269267
ValueError,
270-
"`diff` argument `prepend` with shape.*is invalid"
271-
" for first input with shape.*",
268+
".*shape.*is invalid.*",
272269
dpt.diff,
273270
arr,
274271
prepend=arr_bad_sh,
275272
)
276273

277274
assert_raises_regex(
278275
ValueError,
279-
"`diff` argument `append` with shape.*is invalid"
280-
" for first input with shape.*",
276+
".*shape.*is invalid.*",
281277
dpt.diff,
282278
arr,
283279
append=arr_bad_sh,
@@ -293,53 +289,20 @@ def test_diff_compute_follows_data():
293289
ar2 = dpt.ones(1, dtype="i4", sycl_queue=q2)
294290
ar3 = dpt.ones(1, dtype="i4", sycl_queue=q3)
295291

296-
assert_raises_regex(
297-
ExecutionPlacementError,
298-
"Execution placement can not be unambiguously inferred from input "
299-
"arguments",
300-
dpt.diff,
301-
ar1,
302-
prepend=ar2,
303-
append=ar3,
304-
)
292+
with pytest.raises(ExecutionPlacementError):
293+
dpt.diff(ar1, prepend=ar2, append=ar3)
305294

306-
assert_raises_regex(
307-
ExecutionPlacementError,
308-
"Execution placement can not be unambiguously inferred from input "
309-
"arguments",
310-
dpt.diff,
311-
ar1,
312-
prepend=ar2,
313-
append=0,
314-
)
295+
with pytest.raises(ExecutionPlacementError):
296+
dpt.diff(ar1, prepend=ar2, append=0)
315297

316-
assert_raises_regex(
317-
ExecutionPlacementError,
318-
"Execution placement can not be unambiguously inferred from input "
319-
"arguments",
320-
dpt.diff,
321-
ar1,
322-
prepend=0,
323-
append=ar2,
324-
)
298+
with pytest.raises(ExecutionPlacementError):
299+
dpt.diff(ar1, prepend=0, append=ar2)
325300

326-
assert_raises_regex(
327-
ExecutionPlacementError,
328-
"Execution placement can not be unambiguously inferred from input "
329-
"arguments",
330-
dpt.diff,
331-
ar1,
332-
prepend=ar2,
333-
)
301+
with pytest.raises(ExecutionPlacementError):
302+
dpt.diff(ar1, prepend=ar2)
334303

335-
assert_raises_regex(
336-
ExecutionPlacementError,
337-
"Execution placement can not be unambiguously inferred from input "
338-
"arguments",
339-
dpt.diff,
340-
ar1,
341-
append=ar2,
342-
)
304+
with pytest.raises(ExecutionPlacementError):
305+
dpt.diff(ar1, append=ar2)
343306

344307

345308
def test_diff_input_validation():

0 commit comments

Comments
 (0)