()
| 3227 | |
| 3228 | |
| 3229 | def test_sort_indices_array(): |
| 3230 | arr = pa.array([1, 2, None, 0]) |
| 3231 | result = pc.sort_indices(arr) |
| 3232 | assert result.to_pylist() == [3, 0, 1, 2] |
| 3233 | result = pc.sort_indices(arr, sort_keys=[("dummy", "ascending", "at_end")]) |
| 3234 | assert result.to_pylist() == [3, 0, 1, 2] |
| 3235 | result = pc.sort_indices(arr, sort_keys=[("dummy", "descending", "at_end")]) |
| 3236 | assert result.to_pylist() == [1, 0, 3, 2] |
| 3237 | result = pc.sort_indices(arr, sort_keys=[("dummy", "descending", "at_start")]) |
| 3238 | assert result.to_pylist() == [2, 1, 0, 3] |
| 3239 | # Positional `sort_keys` |
| 3240 | result = pc.sort_indices(arr, [("dummy", "descending", "at_start")]) |
| 3241 | assert result.to_pylist() == [2, 1, 0, 3] |
| 3242 | # Using SortOptions |
| 3243 | result = pc.sort_indices( |
| 3244 | arr, options=pc.SortOptions(sort_keys=[("dummy", "descending", "at_end")]) |
| 3245 | ) |
| 3246 | assert result.to_pylist() == [1, 0, 3, 2] |
| 3247 | result = pc.sort_indices( |
| 3248 | arr, options=pc.SortOptions(sort_keys=[("dummy", "descending", "at_start")]) |
| 3249 | ) |
| 3250 | assert result.to_pylist() == [2, 1, 0, 3] |
| 3251 | |
| 3252 | |
| 3253 | def test_sort_indices_table(): |
nothing calls this directly
no test coverage detected