Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nameexhaustion committed Oct 26, 2023
1 parent 13aefbd commit 15840d3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions py-polars/tests/unit/namespaces/string/test_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,30 @@ def test_split() -> None:
assert_frame_equal(out, expected)
assert_frame_equal(df["x"].str.split("_", inclusive=True).to_frame(), expected)

plan = (
df.lazy()
.select(
a=pl.col("x").str.split(" ", inclusive=False),
b=pl.col("x").str.split_exact(" ", 1, inclusive=False),
)
.explain()
)

assert "str.split(" in plan
assert "str.split_exact(" in plan

plan = (
df.lazy()
.select(
a=pl.col("x").str.split(" ", inclusive=True),
b=pl.col("x").str.split_exact(" ", 1, inclusive=True),
)
.explain()
)

assert "str.split_inclusive(" in plan
assert "str.split_exact_inclusive(" in plan


def test_split_expr() -> None:
df = pl.DataFrame({"x": ["a_a", None, "b", "c*c*c"], "by": ["_", "#", "^", "*"]})
Expand Down

0 comments on commit 15840d3

Please sign in to comment.