Skip to content

Commit

Permalink
Invoke test of readonly flag in asarray to test arrays with both valu…
Browse files Browse the repository at this point in the history
…es of the flag to improve coverage
  • Loading branch information
oleksandr-pavlyk committed Jul 25, 2024
1 parent cbfec84 commit 9a5715f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dpctl/tests/test_usm_ndarray_ctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2380,16 +2380,17 @@ def __sycl_usm_array_interface__(self):
return _suai


def test_asarray_writable_flag():
@pytest.mark.parametrize("ro_flag", [True, False])
def test_asarray_writable_flag(ro_flag):
try:
a = dpt.empty(8)
except dpctl.SyclDeviceCreationError:
pytest.skip("No SYCL devices available")

a.flags["W"] = False
a.flags["W"] = not ro_flag
wrapped = ObjWithSyclUsmArrayInterface(a)

b = dpt.asarray(wrapped)

assert not b.flags["W"]
assert b.flags["W"] == (not ro_flag)
assert b._pointer == a._pointer

0 comments on commit 9a5715f

Please sign in to comment.