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

Function test_table_negative_indexing

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

Source from the content-addressed store, hash-verified

2161
2162
2163def test_table_negative_indexing():
2164 data = [
2165 pa.array(range(5)),
2166 pa.array([-10, -5, 0, 5, 10]),
2167 pa.array([1.0, 2.0, 3.0, 4.0, 5.0]),
2168 pa.array(['ab', 'bc', 'cd', 'de', 'ef']),
2169 ]
2170 table = pa.Table.from_arrays(data, names=tuple('abcd'))
2171
2172 assert table[-1].equals(table[3])
2173 assert table[-2].equals(table[2])
2174 assert table[-3].equals(table[1])
2175 assert table[-4].equals(table[0])
2176
2177 with pytest.raises(IndexError):
2178 table[-5]
2179
2180 with pytest.raises(IndexError):
2181 table[4]
2182
2183
2184def test_concat_batches():

Callers

nothing calls this directly

Calls 2

equalsMethod · 0.80
arrayMethod · 0.45

Tested by

no test coverage detected