Skip to content

Commit ce0d3e6

Browse files
authored
Update test_usm_ndarray_ctor.py
1 parent e0d249f commit ce0d3e6

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

dpctl/tests/test_usm_ndarray_ctor.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2768,10 +2768,16 @@ def test_setitem_copy_as_contig_alignment(dt):
27682768
assert dpt.all(x[1:, :] == vals)
27692769

27702770

2771+
@pytest.mark.parametrize("dt", _all_dtypes)
27712772
def test_asarray_property():
2772-
get_queue_or_skip()
2773+
q = get_queue_or_skip()
27732774

2774-
x = dpt.ones(11, dtype="i4")
2775+
dtype_ = dpt.dtype(dt)
2776+
n0, n1 = 8, 23
27752777

2776-
with pytest.raises(TypeError):
2777-
np.asarray(x)
2778+
x = dpt.eye(n0, n1, dtype=dtype_, sycl_queue=q)
2779+
x_np = np.eye(n0, n1, dtype=dt)
2780+
2781+
# test __array__ attribute
2782+
x_cvt = np.asarray(x)
2783+
np.testing.assert_array_equal(x_np, x_cvt)

0 commit comments

Comments
 (0)