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:598–617  ·  view source on GitHub ↗
(wrapper_class)

Source from the content-addressed store, hash-verified

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