@@ -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)
445482def test_prepare_projection (
0 commit comments