| 1659 | |
| 1660 | |
| 1661 | def test_table_get_field(): |
| 1662 | data = [ |
| 1663 | pa.array(range(5)), |
| 1664 | pa.array([-10, -5, 0, 5, 10]), |
| 1665 | pa.array(range(5, 10)) |
| 1666 | ] |
| 1667 | table = pa.Table.from_arrays(data, names=('a', 'b', 'c')) |
| 1668 | |
| 1669 | assert table.field('a').equals(table.schema.field('a')) |
| 1670 | assert table.field(0).equals(table.schema.field('a')) |
| 1671 | |
| 1672 | with pytest.raises(KeyError): |
| 1673 | table.field('d') |
| 1674 | |
| 1675 | with pytest.raises(TypeError): |
| 1676 | table.field(None) |
| 1677 | |
| 1678 | with pytest.raises(IndexError): |
| 1679 | table.field(4) |
| 1680 | |
| 1681 | |
| 1682 | def test_table_select_column(): |