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

Function test_buffered_output_stream_detach

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

Source from the content-addressed store, hash-verified

1590
1591@pytest.mark.numpy
1592def test_buffered_output_stream_detach():
1593 np_buf = np.zeros(100, dtype=np.int8) # zero-initialized buffer
1594 buf = pa.py_buffer(np_buf)
1595
1596 f = pa.BufferedOutputStream(pa.FixedSizeBufferWriter(buf), buffer_size=4)
1597 f.write(b"12")
1598 assert np_buf[:4].tobytes() == b'\0\0\0\0'
1599 raw = f.detach()
1600 assert f.closed
1601 assert not raw.closed
1602 assert np_buf[:4].tobytes() == b'12\0\0'
1603
1604
1605# ----------------------------------------------------------------------

Callers

nothing calls this directly

Calls 3

BufferedOutputStreamMethod · 0.80
FixedSizeBufferWriterMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected