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

Function test_array_sort_indices

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

Source from the content-addressed store, hash-verified

3260
3261
3262def test_array_sort_indices():
3263 arr = pa.array([1, 2, None, 0])
3264 result = pc.array_sort_indices(arr)
3265 assert result.to_pylist() == [3, 0, 1, 2]
3266 result = pc.array_sort_indices(arr, order="ascending")
3267 assert result.to_pylist() == [3, 0, 1, 2]
3268 result = pc.array_sort_indices(arr, order="descending")
3269 assert result.to_pylist() == [1, 0, 3, 2]
3270 result = pc.array_sort_indices(arr, order="descending",
3271 null_placement="at_start")
3272 assert result.to_pylist() == [2, 1, 0, 3]
3273 result = pc.array_sort_indices(arr, "descending",
3274 null_placement="at_start")
3275 assert result.to_pylist() == [2, 1, 0, 3]
3276
3277 with pytest.raises(ValueError, match="not a valid sort order"):
3278 pc.array_sort_indices(arr, order="nonscending")
3279
3280
3281def test_search_sorted():

Callers

nothing calls this directly

Calls 1

arrayMethod · 0.45

Tested by

no test coverage detected