Skip to content

Commit daa6730

Browse files
author
Victor Garcia Reolid
committed
add extra case to check Axis error is raised
Signed-off-by: Victor Garcia Reolid <[email protected]>
1 parent 216f6b2 commit daa6730

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/link/numba/test_basic.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ def test_Shape(x, i):
393393
[[[3, 2, 1], [5, 6, 7]], -1, "quicksort", None],
394394
[[3, 2, 1], 0, "quicksort", None],
395395
[np.random.randint(0, 100, (40, 40, 40, 40)), 3, "quicksort", None],
396+
[[3, 2, 1], -5, "quicksort", np.exceptions.AxisError],
396397
],
397398
)
398399
def test_Sort(x, axis, kind, exc):
@@ -401,7 +402,13 @@ def test_Sort(x, axis, kind, exc):
401402
else:
402403
g = SortOp(kind)(pt.as_tensor_variable(x))
403404

404-
cm = contextlib.suppress() if not exc else pytest.warns(exc)
405+
cm = (
406+
contextlib.suppress()
407+
if not exc
408+
else pytest.warns(exc)
409+
if isinstance(exc, Warning)
410+
else pytest.raises(exc)
411+
)
405412

406413
with cm:
407414
compare_numba_and_py([], [g], [])

0 commit comments

Comments
 (0)