MCPcopy Create free account
hub / github.com/apache/arrow / test_table_c_array_interface

Function test_table_c_array_interface

python/pyarrow/tests/test_table.py:599–618  ·  view source on GitHub ↗
(wrapper_class)

Source from the content-addressed store, hash-verified

597
598@pytest.mark.parametrize("wrapper_class", [BatchWrapper, BatchDeviceWrapper])
599def 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
621def test_table_c_stream_interface():

Callers

nothing calls this directly

Calls 3

arrayMethod · 0.45
schemaMethod · 0.45
fieldMethod · 0.45

Tested by

no test coverage detected