Skip to content

Commit

Permalink
add tests for negative use cases to improve covergae
Browse files Browse the repository at this point in the history
  • Loading branch information
vtavana committed Oct 30, 2023
1 parent 45ee8e3 commit 265b286
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_arraycreation.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ def test_diag_diagflat(v, k):
assert_array_equal(expected, result)


def test_diag_diagflat_raise_error():
ia = dpnp.array([0, 1, 2, 3, 4])
with pytest.raises(TypeError):
dpnp.diag(ia, k=2.0)

with pytest.raises(TypeError):
dpnp.diagflat(ia, k=2.0)


@pytest.mark.parametrize(
"seq",
[
Expand Down Expand Up @@ -488,6 +497,16 @@ def test_vander(array, dtype, n, increase):
assert_allclose(vander_func(numpy, a_np), vander_func(dpnp, a_dpnp))


def test_vander_raise_error():
a = dpnp.array([1, 2, 3, 4])
with pytest.raises(TypeError):
dpnp.vander(a, N=1.0)

a = dpnp.array([[1, 2], [3, 4]])
with pytest.raises(ValueError):
dpnp.vander(a)


@pytest.mark.parametrize(
"sequence",
[[1, 2, 3, 4], (1, 2, 3, 4)],
Expand Down

0 comments on commit 265b286

Please sign in to comment.