Skip to content

Commit ad47ac3

Browse files
committed
test: Add some failing cases
#2572 (comment)
1 parent dd62ae8 commit ad47ac3

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

tests/plan/expr_expansion_test.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,11 @@ def test_replace_selector(
254254
assert_expr_ir_equal(actual, expected)
255255

256256

257+
XFAIL_MULTI_EXPAND_NESTED = pytest.mark.xfail(
258+
reason="https://github.com/narwhals-dev/narwhals/pull/2572#discussion_r2442614173"
259+
)
260+
261+
257262
@pytest.mark.parametrize(
258263
("into_exprs", "expected"),
259264
[
@@ -440,6 +445,38 @@ def test_replace_selector(
440445
],
441446
id="Selector-BinaryExpr-Over-Prefix",
442447
),
448+
pytest.param(
449+
[
450+
nwp.col("c").sort_by(nwp.col("c", "i")).first().alias("Columns"),
451+
nwp.col("c").sort_by("c", "i").first().alias("Column_x2"),
452+
],
453+
[
454+
named_ir(
455+
"Columns", nwp.col("c").sort_by(nwp.col("c"), nwp.col("i")).first()
456+
),
457+
named_ir(
458+
"Column_x2", nwp.col("c").sort_by(nwp.col("c"), nwp.col("i")).first()
459+
),
460+
],
461+
id="SortBy-Columns",
462+
marks=XFAIL_MULTI_EXPAND_NESTED,
463+
),
464+
pytest.param(
465+
nwp.nth(1).mean().over("k", order_by=nwp.nth(4, 5)),
466+
[
467+
nwp.col("b")
468+
.mean()
469+
.over(nwp.col("k"), order_by=(nwp.col("e"), nwp.col("f")))
470+
],
471+
id="Over-OrderBy-IndexColumns",
472+
marks=XFAIL_MULTI_EXPAND_NESTED,
473+
),
474+
pytest.param(
475+
nwp.col("f").mean().over(ndcs.by_dtype(nw.Date, nw.Datetime)),
476+
[nwp.col("f").max().over(nwp.col("n"), nwp.col("o"))],
477+
id="Over-Partitioned-Selector",
478+
marks=XFAIL_MULTI_EXPAND_NESTED,
479+
),
443480
],
444481
)
445482
def test_prepare_projection(

tests/plan/over_test.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ def duplicate_case(arg: OneOrIterable[IntoExprColumn]) -> ParameterSet:
8282
duplicate_case(ncs.matches(r"a|b")),
8383
duplicate_case(ncs.all() - ncs.by_name(["c", "i"])),
8484
],
85+
ids=[
86+
"tuple[str]",
87+
"col-col",
88+
"nth-nth",
89+
"cols",
90+
"index_columns",
91+
"by_name",
92+
"matches",
93+
"binary_selector",
94+
],
8595
)
8696
def test_over_multiple(data: Data, partition_by: OneOrIterable[IntoExprColumn]) -> None:
8797
expected = {

0 commit comments

Comments
 (0)