Skip to content

Commit 253c20e

Browse files
committed
Adds a test for writable flag view behavior
1 parent bacfa59 commit 253c20e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

dpctl/tests/test_usm_ndarray_ctor.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,25 @@ def test_usm_ndarray_flags_bug_gh_1334():
129129
assert r.flags["F"] and r.flags["C"]
130130

131131

132+
def test_usm_ndarray_writable_flag_views():
133+
get_queue_or_skip()
134+
a = dpt.arange(10, dtype="f4")
135+
a.flags["W"] = False
136+
137+
a.shape = (5, 2)
138+
assert not a.flags.writable
139+
assert not a.T.flags.writable
140+
assert not a.mT.flags.writable
141+
assert not a.real.flags.writable
142+
assert not a[0:3].flags.writable
143+
144+
a = dpt.arange(10, dtype="c8")
145+
a.flags["W"] = False
146+
147+
assert not a.real.flags.writable
148+
assert not a.imag.flags.writable
149+
150+
132151
@pytest.mark.parametrize(
133152
"dtype",
134153
[

0 commit comments

Comments
 (0)