()
| 3369 | |
| 3370 | |
| 3371 | def test_sort_indices_array(): |
| 3372 | arr = pa.array([1, 2, None, 0]) |
| 3373 | result = pc.sort_indices(arr) |
| 3374 | assert result.to_pylist() == [3, 0, 1, 2] |
| 3375 | result = pc.sort_indices(arr, sort_keys=[("dummy", "ascending", "at_end")]) |
| 3376 | assert result.to_pylist() == [3, 0, 1, 2] |
| 3377 | result = pc.sort_indices(arr, sort_keys=[("dummy", "descending", "at_end")]) |
| 3378 | assert result.to_pylist() == [1, 0, 3, 2] |
| 3379 | result = pc.sort_indices(arr, sort_keys=[("dummy", "descending", "at_start")]) |
| 3380 | assert result.to_pylist() == [2, 1, 0, 3] |
| 3381 | # Positional `sort_keys` |
| 3382 | result = pc.sort_indices(arr, [("dummy", "descending", "at_start")]) |
| 3383 | assert result.to_pylist() == [2, 1, 0, 3] |
| 3384 | # Using SortOptions |
| 3385 | result = pc.sort_indices( |
| 3386 | arr, options=pc.SortOptions(sort_keys=[("dummy", "descending", "at_end")]) |
| 3387 | ) |
| 3388 | assert result.to_pylist() == [1, 0, 3, 2] |
| 3389 | result = pc.sort_indices( |
| 3390 | arr, options=pc.SortOptions(sort_keys=[("dummy", "descending", "at_start")]) |
| 3391 | ) |
| 3392 | assert result.to_pylist() == [2, 1, 0, 3] |
| 3393 | |
| 3394 | |
| 3395 | def test_sort_indices_table(): |
nothing calls this directly
no test coverage detected