Skip to content

Commit 9a5715f

Browse files
Invoke test of readonly flag in asarray to test arrays with both values of the flag to improve coverage
1 parent cbfec84 commit 9a5715f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

dpctl/tests/test_usm_ndarray_ctor.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2380,16 +2380,17 @@ def __sycl_usm_array_interface__(self):
23802380
return _suai
23812381

23822382

2383-
def test_asarray_writable_flag():
2383+
@pytest.mark.parametrize("ro_flag", [True, False])
2384+
def test_asarray_writable_flag(ro_flag):
23842385
try:
23852386
a = dpt.empty(8)
23862387
except dpctl.SyclDeviceCreationError:
23872388
pytest.skip("No SYCL devices available")
23882389

2389-
a.flags["W"] = False
2390+
a.flags["W"] = not ro_flag
23902391
wrapped = ObjWithSyclUsmArrayInterface(a)
23912392

23922393
b = dpt.asarray(wrapped)
23932394

2394-
assert not b.flags["W"]
2395+
assert b.flags["W"] == (not ro_flag)
23952396
assert b._pointer == a._pointer

0 commit comments

Comments
 (0)