| 597 | |
| 598 | @pytest.mark.parametrize("wrapper_class", [BatchWrapper, BatchDeviceWrapper]) |
| 599 | def test_table_c_array_interface(wrapper_class): |
| 600 | data = pa.record_batch([ |
| 601 | pa.array([1, 2, 3], type=pa.int64()) |
| 602 | ], names=['a']) |
| 603 | wrapper = wrapper_class(data) |
| 604 | |
| 605 | # Can roundtrip through the wrapper. |
| 606 | result = pa.table(wrapper) |
| 607 | expected = pa.Table.from_batches([data]) |
| 608 | assert result == expected |
| 609 | |
| 610 | # Can also import with a schema that implementer can cast to. |
| 611 | castable_schema = pa.schema([ |
| 612 | pa.field('a', pa.int32()) |
| 613 | ]) |
| 614 | result = pa.table(wrapper, schema=castable_schema) |
| 615 | expected = pa.table({ |
| 616 | 'a': pa.array([1, 2, 3], type=pa.int32()) |
| 617 | }) |
| 618 | assert result == expected |
| 619 | |
| 620 | |
| 621 | def test_table_c_stream_interface(): |