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

Function test_stream_write_dispatch

python/pyarrow/tests/test_ipc.py:385–402  ·  view source on GitHub ↗
(stream_fixture)

Source from the content-addressed store, hash-verified

383
384@pytest.mark.pandas
385def test_stream_write_dispatch(stream_fixture):
386 # ARROW-1616
387 df = pd.DataFrame({
388 'one': np.random.randn(5),
389 'two': pd.Categorical(['foo', np.nan, 'bar', 'foo', 'foo'],
390 categories=['foo', 'bar'],
391 ordered=True)
392 })
393 table = pa.Table.from_pandas(df, preserve_index=False)
394 batch = pa.RecordBatch.from_pandas(df, preserve_index=False)
395 with stream_fixture._get_writer(stream_fixture.sink, table.schema) as wr:
396 wr.write(table)
397 wr.write(batch)
398
399 table = (pa.ipc.open_stream(pa.BufferReader(stream_fixture.get_source()))
400 .read_all())
401 assert_frame_equal(table.to_pandas(),
402 pd.concat([df, df], ignore_index=True))
403
404
405@pytest.mark.pandas

Callers

nothing calls this directly

Calls 4

BufferReaderMethod · 0.80
get_sourceMethod · 0.80
_get_writerMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected