(stream_fixture)
| 266 | |
| 267 | @pytest.mark.pandas |
| 268 | def test_stream_categorical_roundtrip(stream_fixture): |
| 269 | df = pd.DataFrame({ |
| 270 | 'one': np.random.randn(5), |
| 271 | 'two': pd.Categorical(['foo', np.nan, 'bar', 'foo', 'foo'], |
| 272 | categories=['foo', 'bar'], |
| 273 | ordered=True) |
| 274 | }) |
| 275 | batch = pa.RecordBatch.from_pandas(df) |
| 276 | with stream_fixture._get_writer(stream_fixture.sink, batch.schema) as wr: |
| 277 | wr.write_batch(batch) |
| 278 | |
| 279 | table = (pa.ipc.open_stream(pa.BufferReader(stream_fixture.get_source())) |
| 280 | .read_all()) |
| 281 | assert_frame_equal(table.to_pandas(), df) |
| 282 | |
| 283 | |
| 284 | def test_open_stream_from_buffer(stream_fixture): |
nothing calls this directly
no test coverage detected