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

Function test_nativefile_write_memoryview

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

Source from the content-addressed store, hash-verified

1008
1009@pytest.mark.numpy
1010def test_nativefile_write_memoryview():
1011 f = pa.BufferOutputStream()
1012 data = b'ok'
1013
1014 arr = np.frombuffer(data, dtype='S1')
1015
1016 f.write(arr)
1017 f.write(bytearray(data))
1018 f.write(pa.py_buffer(data))
1019 with pytest.raises(TypeError):
1020 f.write(data.decode('utf8'))
1021
1022 buf = f.getvalue()
1023
1024 assert buf.to_pybytes() == data * 3
1025
1026
1027@pytest.mark.parametrize("dst_buf", [b"a", memoryview(b"a")])

Callers

nothing calls this directly

Calls 3

BufferOutputStreamMethod · 0.80
writeMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected