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

Function test_buffered_output_stream

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

Source from the content-addressed store, hash-verified

1572
1573@pytest.mark.numpy
1574def test_buffered_output_stream():
1575 np_buf = np.zeros(100, dtype=np.int8) # zero-initialized buffer
1576 buf = pa.py_buffer(np_buf)
1577
1578 raw = pa.FixedSizeBufferWriter(buf)
1579 f = pa.BufferedOutputStream(raw, buffer_size=4)
1580 f.write(b"12")
1581 assert np_buf[:4].tobytes() == b'\0\0\0\0'
1582 f.flush()
1583 assert np_buf[:4].tobytes() == b'12\0\0'
1584 f.write(b"3456789")
1585 f.close()
1586 assert f.closed
1587 assert raw.closed
1588 assert np_buf[:10].tobytes() == b'123456789\0'
1589
1590
1591@pytest.mark.numpy

Callers

nothing calls this directly

Calls 5

FixedSizeBufferWriterMethod · 0.80
BufferedOutputStreamMethod · 0.80
flushMethod · 0.80
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected