MCPcopy Index your code
hub / github.com/numpy/numpy / test_writeable_from_readonly

Method test_writeable_from_readonly

numpy/_core/tests/test_multiarray.py:157–166  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

155 view2.flags.writeable = True
156
157 def test_writeable_from_readonly(self):
158 # gh-9440 - make sure fromstring, from buffer on readonly buffers
159 # set writeable False
160 data = b'\x00' * 100
161 vals = np.frombuffer(data, 'B')
162 assert_raises(ValueError, vals.setflags, write=True)
163 types = np.dtype([('vals', 'u1'), ('res3', 'S4')])
164 values = np._core.records.fromstring(data, types)
165 vals = values['vals']
166 assert_raises(ValueError, vals.setflags, write=True)
167
168 def test_writeable_from_buffer(self):
169 data = bytearray(b'\x00' * 100)

Callers

nothing calls this directly

Calls 3

assert_raisesFunction · 0.90
fromstringMethod · 0.80
dtypeMethod · 0.45

Tested by

no test coverage detected