(file_fixture)
| 214 | |
| 215 | |
| 216 | def test_open_file_from_buffer(file_fixture): |
| 217 | # ARROW-2859; APIs accept the buffer protocol |
| 218 | file_fixture.write_batches() |
| 219 | source = file_fixture.get_source() |
| 220 | |
| 221 | reader1 = pa.ipc.open_file(source) |
| 222 | reader2 = pa.ipc.open_file(pa.BufferReader(source)) |
| 223 | reader3 = pa.RecordBatchFileReader(source) |
| 224 | |
| 225 | result1 = reader1.read_all() |
| 226 | result2 = reader2.read_all() |
| 227 | result3 = reader3.read_all() |
| 228 | |
| 229 | assert result1.equals(result2) |
| 230 | assert result1.equals(result3) |
| 231 | |
| 232 | st1 = reader1.stats |
| 233 | assert st1.num_messages == 6 |
| 234 | assert st1.num_record_batches == 5 |
| 235 | assert reader2.stats == st1 |
| 236 | assert reader3.stats == st1 |
| 237 | |
| 238 | |
| 239 | @pytest.mark.pandas |
nothing calls this directly
no test coverage detected