MCPcopy Create free account
hub / github.com/apache/arrow / test_buffer_memoryview_is_immutable

Function test_buffer_memoryview_is_immutable

python/pyarrow/tests/test_io.py:943–960  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

941
942
943def test_buffer_memoryview_is_immutable():
944 val = b'some data'
945
946 buf = pa.py_buffer(val)
947 assert not buf.is_mutable
948 assert isinstance(buf, pa.Buffer)
949
950 result = memoryview(buf)
951 assert result.readonly
952
953 with pytest.raises(TypeError) as exc:
954 result[0] = b'h'
955 assert 'cannot modify read-only' in str(exc.value)
956
957 b = bytes(buf)
958 with pytest.raises(TypeError) as exc:
959 b[0] = b'h'
960 assert 'cannot modify read-only' in str(exc.value)
961
962
963def test_uninitialized_buffer():

Callers

nothing calls this directly

Calls 1

bytesFunction · 0.85

Tested by

no test coverage detected