MCPcopy Create free account
hub / github.com/apache/arrow-rs / test_table_pycapsule

Function test_table_pycapsule

arrow-pyarrow-integration-testing/tests/test_sql.py:639–656  ·  view source on GitHub ↗

Python -> Rust -> Python

()

Source from the content-addressed store, hash-verified

637
638@pytest.mark.skipif(PYARROW_PRE_14, reason="requires pyarrow 14")
639def test_table_pycapsule():
640 """
641 Python -> Rust -> Python
642 """
643 schema = pa.schema([pa.field(name='ints', type=pa.list_(pa.int32()), metadata={b'key1': b'value1'})], metadata={b'key1': b'value1'})
644 batches = [
645 pa.record_batch([[[1], [2, 42]]], schema),
646 pa.record_batch([[None, [], [5, 6]]], schema),
647 ]
648 table = pa.Table.from_batches(batches)
649 wrapped = StreamWrapper(table)
650 b = rust.round_trip_record_batch_reader(wrapped)
651 new_table = b.read_all()
652
653 assert table == new_table
654 assert table.schema == new_table.schema
655 assert table.schema.metadata == new_table.schema.metadata
656 assert len(table.to_batches()) == len(new_table.to_batches())
657
658
659def test_table_empty():

Callers

nothing calls this directly

Calls 4

StreamWrapperClass · 0.85
schemaMethod · 0.45
fieldMethod · 0.45
record_batchMethod · 0.45

Tested by

no test coverage detected