| 783 | |
| 784 | |
| 785 | def 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 | |
| 806 | def test_recordbatch_select_column(): |