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:944–961  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

bytesFunction · 0.85

Tested by

no test coverage detected