Skip to content

Commit

Permalink
Add test for deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Aug 26, 2023
1 parent 52357dd commit 2c30ac9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion py-polars/polars/expr/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -4752,7 +4752,10 @@ def xor(self, other: Any) -> Self:
... pl.col("x").map_elements(binary_string).alias("bin_x"),
... pl.col("y").map_elements(binary_string).alias("bin_y"),
... pl.col("x").xor(pl.col("y")).alias("xor_xy"),
... pl.col("x").xor(pl.col("y")).apply(binary_string).alias("bin_xor_xy"),
... pl.col("x")
... .xor(pl.col("y"))
... .map_elements(binary_string)
... .alias("bin_xor_xy"),
... )
shape: (4, 6)
┌─────┬─────┬──────────┬──────────┬────────┬────────────┐
Expand Down
7 changes: 7 additions & 0 deletions py-polars/tests/unit/operations/test_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,3 +414,10 @@ def test_map_elements_on_empty_col_10639() -> None:
"B": [],
"Foo": [],
}


def test_apply_deprecated() -> None:
with pytest.deprecated_call():
pl.col("a").apply(lambda x: x + 1)
with pytest.deprecated_call():
pl.Series([1, 2, 3]).apply(lambda x: x + 1)

0 comments on commit 2c30ac9

Please sign in to comment.