(file_fixture)
| 190 | |
| 191 | |
| 192 | def test_open_file_from_buffer(file_fixture): |
| 193 | # ARROW-2859; APIs accept the buffer protocol |
| 194 | file_fixture.write_batches() |
| 195 | source = file_fixture.get_source() |
| 196 | |
| 197 | reader1 = pa.ipc.open_file(source) |
| 198 | reader2 = pa.ipc.open_file(pa.BufferReader(source)) |
| 199 | reader3 = pa.RecordBatchFileReader(source) |
| 200 | |
| 201 | result1 = reader1.read_all() |
| 202 | result2 = reader2.read_all() |
| 203 | result3 = reader3.read_all() |
| 204 | |
| 205 | assert result1.equals(result2) |
| 206 | assert result1.equals(result3) |
| 207 | |
| 208 | st1 = reader1.stats |
| 209 | assert st1.num_messages == 6 |
| 210 | assert st1.num_record_batches == 5 |
| 211 | assert reader2.stats == st1 |
| 212 | assert reader3.stats == st1 |
| 213 | |
| 214 | |
| 215 | @pytest.mark.pandas |
nothing calls this directly
no test coverage detected