Skip to content

Commit

Permalink
test: add tests for check not to panic
Browse files Browse the repository at this point in the history
  • Loading branch information
eitsupi committed Mar 23, 2024
1 parent 289d24f commit 73a3e7d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions py-polars/tests/unit/operations/test_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,19 @@ def test_sort_by_exprs() -> None:
assert out.to_list() == [1, -1, 2, -2]


def test_not_panic_on_arg_sort_by() -> None:
with pytest.raises(
pl.ComputeError,
match="cannot determine output column without a context for this expression",
):
pl.arg_sort_by("*")

with pytest.raises(
pl.ComputeError, match="this expression may produce multiple output names"
):
pl.arg_sort_by(pl.col(["a", "b"]))


def test_arg_sort_nulls() -> None:
a = pl.Series("a", [1.0, 2.0, 3.0, None, None])
assert a.arg_sort(nulls_last=True).to_list() == [0, 1, 2, 3, 4]
Expand Down

0 comments on commit 73a3e7d

Please sign in to comment.