Skip to content

Commit

Permalink
Added a test based on example found by @npolina4
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksandr-pavlyk committed Mar 29, 2023
1 parent 9150790 commit 3036a67
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions dpctl/tests/test_tensor_asarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,3 +271,25 @@ def test_asarray_seq_of_array_different_queue():
ar = dpt.asarray([m, [w, v]], sycl_queue=qprof)
assert ar.shape == (2, 2, 4)
assert ar.sycl_queue == qprof


def test_asarray_seq_of_suai():
get_queue_or_skip()

class Dummy:
def __init__(self, obj, iface):
self.obj = obj
self.__sycl_usm_array_interface__ = iface

o = dpt.empty(0, usm_type="shared")
d = Dummy(o, o.__sycl_usm_array_interface__)
x = dpt.asarray(d)
assert x.shape == (0,)
assert x.usm_type == o.usm_type
assert x._pointer == o._pointer
assert x.sycl_queue == o.sycl_queue

x = dpt.asarray([d, d])
assert x.shape == (2, 0)
assert x.usm_type == o.usm_type
assert x.sycl_queue == o.sycl_queue

0 comments on commit 3036a67

Please sign in to comment.