Skip to content

Commit 699469d

Browse files
Address remark
1 parent 6ef86be commit 699469d

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

dpnp/tests/test_mathematical.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,10 @@ def test_complex_fp(self, dtype_x, dtype_y):
11841184
@pytest.mark.parametrize(
11851185
"dtype", get_all_dtypes(no_complex=True, no_none=True)
11861186
)
1187-
def test_left_right_args(self, dtype):
1187+
@pytest.mark.parametrize(
1188+
"left, right", [[-40, 40], [dpnp.array(-40), dpnp.array(40)]]
1189+
)
1190+
def test_left_right_args(self, dtype, left, right):
11881191
x = numpy.array([-1, 0, 1, 2, 3, 4, 5, 6], dtype=dtype)
11891192
xp = numpy.array([0, 3, 6], dtype=dtype)
11901193
fp = numpy.array([0, 9, 18], dtype=dtype)
@@ -1193,25 +1196,14 @@ def test_left_right_args(self, dtype):
11931196
ixp = dpnp.array(xp)
11941197
ifp = dpnp.array(fp)
11951198

1196-
expected = numpy.interp(x, xp, fp, left=-40, right=40)
1197-
result = dpnp.interp(ix, ixp, ifp, left=-40, right=40)
1198-
assert_dtype_allclose(result, expected)
1199-
1200-
# left and right as ndarray
12011199
expected = numpy.interp(
12021200
x,
12031201
xp,
12041202
fp,
1205-
left=numpy.array(-40, dtype=dtype),
1206-
right=numpy.array(40, dtype=dtype),
1207-
)
1208-
result = dpnp.interp(
1209-
ix,
1210-
ixp,
1211-
ifp,
1212-
left=dpnp.array(-40, dtype=dtype),
1213-
right=dpnp.array(40, dtype=dtype),
1203+
left=get_array(numpy, left),
1204+
right=get_array(numpy, right),
12141205
)
1206+
result = dpnp.interp(ix, ixp, ifp, left=left, right=right)
12151207
assert_dtype_allclose(result, expected)
12161208

12171209
@pytest.mark.parametrize("val", [numpy.nan, numpy.inf, -numpy.inf])

0 commit comments

Comments
 (0)