Skip to content

Commit 19ca014

Browse files
committed
Adds tests for fixes to real/imag properties
1 parent 72520b7 commit 19ca014

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

dpctl/tests/test_usm_ndarray_ctor.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,6 +1461,23 @@ def test_real_imag_views():
14611461
X_scalar[...] = complex(n * m, 2 * n * m)
14621462
assert X_scalar.real and X_scalar.imag
14631463

1464+
# check that _zero_like works for scalars
1465+
X_scalar = dpt.usm_ndarray((), dtype="f4")
1466+
assert isinstance(X_scalar.imag, dpt.usm_ndarray)
1467+
assert not X_scalar.imag
1468+
1469+
1470+
def test_real_imag_views_fp16():
1471+
q = get_queue_or_skip()
1472+
skip_if_dtype_not_supported(dpt.float16, q)
1473+
1474+
X = dpt.usm_ndarray(
1475+
(3, 4), dtype=dpt.float16, buffer_ctor_kwargs={"queue": q}
1476+
)
1477+
assert isinstance(X.real, dpt.usm_ndarray) and isinstance(
1478+
X.imag, dpt.usm_ndarray
1479+
)
1480+
14641481

14651482
@pytest.mark.parametrize(
14661483
"dtype",

0 commit comments

Comments
 (0)