@@ -81,6 +81,21 @@ def test_function_expr_horizontal(
8181 assert sequence_node != unrelated_node
8282
8383
84+ # TODO @dangotbanned: Get partity with the existing tests
85+ # https://github.com/narwhals-dev/narwhals/blob/63c8e4771a1df4e0bfeea5559c303a4a447d5cc2/tests/expression_parsing_test.py#L48-L105
86+
87+
88+ def test_misleading_order_by () -> None :
89+ with pytest .raises (InvalidOperationError ):
90+ nw .col ("a" ).mean ().over (order_by = "b" )
91+ with pytest .raises (InvalidOperationError ):
92+ nw .col ("a" ).rank ().over (order_by = "b" )
93+
94+
95+ # `test_double_over` is already covered in the later `test_nested_over`
96+
97+
98+ # test_double_agg
8499def test_invalid_repeat_agg () -> None :
85100 with pytest .raises (InvalidOperationError ):
86101 nwd .col ("a" ).mean ().mean ()
@@ -90,3 +105,45 @@ def test_invalid_repeat_agg() -> None:
90105 nwd .col ("a" ).any ().std ()
91106 with pytest .raises (InvalidOperationError ):
92107 nwd .col ("a" ).all ().quantile (0.5 , "linear" )
108+
109+
110+ def test_filter_aggregation () -> None :
111+ with pytest .raises (InvalidOperationError ):
112+ nwd .col ("a" ).mean ().drop_nulls ()
113+
114+
115+ # TODO @dangotbanned: Add `head`, `tail`
116+ def test_head_aggregation () -> None :
117+ with pytest .raises (InvalidOperationError ):
118+ nwd .col ("a" ).mean ().head () # type: ignore[attr-defined]
119+
120+
121+ def test_rank_aggregation () -> None :
122+ with pytest .raises (InvalidOperationError ):
123+ nwd .col ("a" ).mean ().rank ()
124+
125+
126+ def test_diff_aggregation () -> None :
127+ with pytest .raises (InvalidOperationError ):
128+ nwd .col ("a" ).mean ().diff ()
129+
130+
131+ def test_invalid_over () -> None :
132+ with pytest .raises (InvalidOperationError ):
133+ nwd .col ("a" ).fill_null (3 ).over ("b" )
134+
135+
136+ def test_nested_over () -> None :
137+ with pytest .raises (InvalidOperationError ):
138+ nwd .col ("a" ).mean ().over ("b" ).over ("c" )
139+ with pytest .raises (InvalidOperationError ):
140+ nwd .col ("a" ).mean ().over ("b" ).over ("c" , order_by = "i" )
141+
142+
143+ def test_filtration_over () -> None :
144+ with pytest .raises (InvalidOperationError ):
145+ nwd .col ("a" ).drop_nulls ().over ("b" )
146+ with pytest .raises (InvalidOperationError ):
147+ nwd .col ("a" ).drop_nulls ().over ("b" , order_by = "i" )
148+ with pytest .raises (InvalidOperationError ):
149+ nwd .col ("a" ).diff ().drop_nulls ().over ("b" , order_by = "i" )
0 commit comments