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

Function test_inverse_permutation

python/pyarrow/tests/test_compute.py:1776–1789  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1774
1775
1776def test_inverse_permutation():
1777 arr0 = pa.array([], type=pa.int32())
1778 arr = pa.chunked_array([
1779 arr0, [9, 7, 5, 3, 1], [0], [2, 4, 6], [8], arr0,
1780 ])
1781 expected = pa.chunked_array([[5, 4, 6, 3, 7, 2, 8, 1, 9, 0]], type=pa.int32())
1782 assert pc.inverse_permutation(arr).equals(expected)
1783
1784 options = pc.InversePermutationOptions(max_index=9, output_type=pa.int32())
1785 assert pc.inverse_permutation(arr, options=options).equals(expected)
1786 assert pc.inverse_permutation(arr, max_index=-1).equals(expected)
1787
1788 with pytest.raises(ArrowIndexError, match="Index out of bounds: 9"):
1789 pc.inverse_permutation(arr, max_index=4)
1790
1791
1792def test_scatter():

Callers

nothing calls this directly

Calls 4

chunked_arrayMethod · 0.80
equalsMethod · 0.80
arrayMethod · 0.45

Tested by

no test coverage detected