MCPcopy Create free account
hub / github.com/pybind/pybind11 / test_selective_readonly_buffer

Function test_selective_readonly_buffer

tests/test_buffers.py:165–178  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

163
164
165def test_selective_readonly_buffer():
166 buf = m.BufferReadOnlySelect()
167
168 memoryview(buf)[0] = 0x64
169 assert buf.value == 0x64
170
171 io.BytesIO(b"A").readinto(buf)
172 assert buf.value == ord(b"A")
173
174 buf.readonly = True
175 with pytest.raises(TypeError):
176 memoryview(buf)[0] = 0
177 with pytest.raises(TypeError):
178 io.BytesIO(b"1").readinto(buf)
179
180
181def test_ctypes_array_1d():

Callers

nothing calls this directly

Calls 1

memoryviewClass · 0.85

Tested by

no test coverage detected