(stream_fixture)
| 380 | |
| 381 | @pytest.mark.pandas |
| 382 | def test_stream_write_table_batches(stream_fixture): |
| 383 | # ARROW-504 |
| 384 | df = pd.DataFrame({ |
| 385 | 'one': np.random.randn(20), |
| 386 | }) |
| 387 | |
| 388 | b1 = pa.RecordBatch.from_pandas(df[:10], preserve_index=False) |
| 389 | b2 = pa.RecordBatch.from_pandas(df, preserve_index=False) |
| 390 | |
| 391 | table = pa.Table.from_batches([b1, b2, b1]) |
| 392 | |
| 393 | with stream_fixture._get_writer(stream_fixture.sink, table.schema) as wr: |
| 394 | wr.write_table(table, max_chunksize=15) |
| 395 | |
| 396 | batches = list(pa.ipc.open_stream(stream_fixture.get_source())) |
| 397 | |
| 398 | assert list(map(len, batches)) == [10, 15, 5, 10] |
| 399 | result_table = pa.Table.from_batches(batches) |
| 400 | assert_frame_equal(result_table.to_pandas(), |
| 401 | pd.concat([df[:10], df, df[:10]], |
| 402 | ignore_index=True)) |
| 403 | |
| 404 | |
| 405 | def test_stream_simple_roundtrip(stream_fixture): |
nothing calls this directly
no test coverage detected