(stream_fixture)
| 404 | |
| 405 | @pytest.mark.pandas |
| 406 | def test_stream_write_table_batches(stream_fixture): |
| 407 | # ARROW-504 |
| 408 | df = pd.DataFrame({ |
| 409 | 'one': np.random.randn(20), |
| 410 | }) |
| 411 | |
| 412 | b1 = pa.RecordBatch.from_pandas(df[:10], preserve_index=False) |
| 413 | b2 = pa.RecordBatch.from_pandas(df, preserve_index=False) |
| 414 | |
| 415 | table = pa.Table.from_batches([b1, b2, b1]) |
| 416 | |
| 417 | with stream_fixture._get_writer(stream_fixture.sink, table.schema) as wr: |
| 418 | wr.write_table(table, max_chunksize=15) |
| 419 | |
| 420 | batches = list(pa.ipc.open_stream(stream_fixture.get_source())) |
| 421 | |
| 422 | assert list(map(len, batches)) == [10, 15, 5, 10] |
| 423 | result_table = pa.Table.from_batches(batches) |
| 424 | assert_frame_equal(result_table.to_pandas(), |
| 425 | pd.concat([df[:10], df, df[:10]], |
| 426 | ignore_index=True)) |
| 427 | |
| 428 | |
| 429 | def test_stream_simple_roundtrip(stream_fixture): |
nothing calls this directly
no test coverage detected