Skip to content

Commit 3036a67

Browse files
Added a test based on example found by @npolina4
1 parent 9150790 commit 3036a67

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

dpctl/tests/test_tensor_asarray.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,3 +271,25 @@ def test_asarray_seq_of_array_different_queue():
271271
ar = dpt.asarray([m, [w, v]], sycl_queue=qprof)
272272
assert ar.shape == (2, 2, 4)
273273
assert ar.sycl_queue == qprof
274+
275+
276+
def test_asarray_seq_of_suai():
277+
get_queue_or_skip()
278+
279+
class Dummy:
280+
def __init__(self, obj, iface):
281+
self.obj = obj
282+
self.__sycl_usm_array_interface__ = iface
283+
284+
o = dpt.empty(0, usm_type="shared")
285+
d = Dummy(o, o.__sycl_usm_array_interface__)
286+
x = dpt.asarray(d)
287+
assert x.shape == (0,)
288+
assert x.usm_type == o.usm_type
289+
assert x._pointer == o._pointer
290+
assert x.sycl_queue == o.sycl_queue
291+
292+
x = dpt.asarray([d, d])
293+
assert x.shape == (2, 0)
294+
assert x.usm_type == o.usm_type
295+
assert x.sycl_queue == o.sycl_queue

0 commit comments

Comments
 (0)