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

Function test_recordbatch_get_field

python/pyarrow/tests/test_table.py:785–803  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

783
784
785def test_recordbatch_get_field():
786 data = [
787 pa.array(range(5)),
788 pa.array([-10, -5, 0, 5, 10]),
789 pa.array(range(5, 10))
790 ]
791 batch = pa.RecordBatch.from_arrays(data, names=('a', 'b', 'c'))
792
793 assert batch.field('a').equals(batch.schema.field('a'))
794 assert batch.field(0).equals(batch.schema.field('a'))
795
796 with pytest.raises(KeyError):
797 batch.field('d')
798
799 with pytest.raises(TypeError):
800 batch.field(None)
801
802 with pytest.raises(IndexError):
803 batch.field(4)
804
805
806def test_recordbatch_select_column():

Callers

nothing calls this directly

Calls 3

equalsMethod · 0.80
arrayMethod · 0.45
fieldMethod · 0.45

Tested by

no test coverage detected