| 559 | |
| 560 | @pytest.mark.parametrize("wrapper_class", [BatchWrapper, BatchDeviceWrapper]) |
| 561 | def test_recordbatch_c_array_interface(wrapper_class): |
| 562 | data = pa.record_batch([ |
| 563 | pa.array([1, 2, 3], type=pa.int64()) |
| 564 | ], names=['a']) |
| 565 | wrapper = wrapper_class(data) |
| 566 | |
| 567 | # Can roundtrip through the wrapper. |
| 568 | result = pa.record_batch(wrapper) |
| 569 | assert result == data |
| 570 | |
| 571 | # Can also import with a schema that implementer can cast to. |
| 572 | castable_schema = pa.schema([ |
| 573 | pa.field('a', pa.int32()) |
| 574 | ]) |
| 575 | result = pa.record_batch(wrapper, schema=castable_schema) |
| 576 | expected = pa.record_batch([ |
| 577 | pa.array([1, 2, 3], type=pa.int32()) |
| 578 | ], names=['a']) |
| 579 | assert result == expected |
| 580 | |
| 581 | |
| 582 | def test_recordbatch_c_array_interface_device_unsupported_keyword(): |