Skip to content

Commit

Permalink
test: Add test for 21581 (#21617)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 authored Mar 6, 2025
1 parent 5a28d2a commit 9c4dc9f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions py-polars/tests/unit/test_scalar.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,21 @@ def test_scalar_identification_function_expr_in_binary() -> None:
def test_scalar_rechunk_20627() -> None:
df = pl.concat(2 * [pl.Series([1])]).filter(pl.Series([False, True])).to_frame()
assert df.rechunk().to_series().n_chunks() == 1


def test_split_scalar_21581() -> None:
df = pl.DataFrame({"a": [1.0, 2.0, 3.0]})
df = df.with_columns(
[
pl.col("a").shift(-1).alias("next_a"),
pl.lit(True).alias("lit"),
]
)

assert df.filter(df["next_a"] != 99.0).with_columns(
[pl.lit(False).alias("lit")]
).to_dict(as_series=False) == {
"a": [1.0, 2.0],
"next_a": [2.0, 3.0],
"lit": [False, False],
}

0 comments on commit 9c4dc9f

Please sign in to comment.