()
| 163 | |
| 164 | |
| 165 | def 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 | |
| 181 | def test_ctypes_array_1d(): |