Skip to content

Commit 3dda4f4

Browse files
Added tests for Device.__eq__ and Device.__hash__
1 parent b0fa998 commit 3dda4f4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

dpctl/tests/test_usm_ndarray_ctor.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,3 +1575,19 @@ def test_asarray_uint64():
15751575
Xnp = np.ndarray(1, dtype=np.uint64)
15761576
X = dpt.asarray(Xnp)
15771577
assert X.dtype == Xnp.dtype
1578+
1579+
1580+
def test_Device():
1581+
try:
1582+
dev = dpctl.select_default_device()
1583+
d1 = dpt.Device.create_device(dev)
1584+
d2 = dpt.Device.create_device(dev)
1585+
except (dpctl.SyclQueueCreationError, dpctl.SyclDeviceCreationError):
1586+
pytest.skip(
1587+
"Could not create default device, or a queue that targets it"
1588+
)
1589+
assert d1 == d2
1590+
dict = {d1: 1}
1591+
assert dict[d2] == 1
1592+
assert d1 == d2.sycl_queue
1593+
assert not d1 == Ellipsis

0 commit comments

Comments
 (0)