Skip to content

Commit 7cfd0a4

Browse files
committed
Improve check if any zero element is passed as start or stop
1 parent 713d256 commit 7cfd0a4

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

dpnp/dpnp_algo/dpnp_arraycreation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def _check_has_zero_val(a):
6262
elif hasattr(a, "any"):
6363
if (a == 0).any():
6464
return True
65-
elif any(val == 0 for val in a):
65+
elif (numpy.array(a) == 0).any():
6666
return True
6767
return False
6868

dpnp/tests/test_arraycreation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ def test_num_zero(self):
130130
(dpnp.array([0]), 7, 10),
131131
(-2, numpy.array([[0]]), 7),
132132
([2, 4, 0], 3, 5),
133+
(10, [[1, 0], [2, 3]], 3),
133134
],
134135
)
135136
def test_zero_error(self, start, stop, num):

0 commit comments

Comments
 (0)