Skip to content

Commit 265b286

Browse files
committed
add tests for negative use cases to improve covergae
1 parent 45ee8e3 commit 265b286

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/test_arraycreation.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,15 @@ def test_diag_diagflat(v, k):
129129
assert_array_equal(expected, result)
130130

131131

132+
def test_diag_diagflat_raise_error():
133+
ia = dpnp.array([0, 1, 2, 3, 4])
134+
with pytest.raises(TypeError):
135+
dpnp.diag(ia, k=2.0)
136+
137+
with pytest.raises(TypeError):
138+
dpnp.diagflat(ia, k=2.0)
139+
140+
132141
@pytest.mark.parametrize(
133142
"seq",
134143
[
@@ -488,6 +497,16 @@ def test_vander(array, dtype, n, increase):
488497
assert_allclose(vander_func(numpy, a_np), vander_func(dpnp, a_dpnp))
489498

490499

500+
def test_vander_raise_error():
501+
a = dpnp.array([1, 2, 3, 4])
502+
with pytest.raises(TypeError):
503+
dpnp.vander(a, N=1.0)
504+
505+
a = dpnp.array([[1, 2], [3, 4]])
506+
with pytest.raises(ValueError):
507+
dpnp.vander(a)
508+
509+
491510
@pytest.mark.parametrize(
492511
"sequence",
493512
[[1, 2, 3, 4], (1, 2, 3, 4)],

0 commit comments

Comments
 (0)