diff --git a/narwhals/expr.py b/narwhals/expr.py index 4f455baf1..fd53bbd2a 100644 --- a/narwhals/expr.py +++ b/narwhals/expr.py @@ -4222,7 +4222,7 @@ def max_horizontal(*exprs: IntoExpr | Iterable[IntoExpr]) -> Expr: a: [[4,8,3]] """ if not exprs: - msg = "At least one expression must be passed to `sum_horizontal`" + msg = "At least one expression must be passed to `max_horizontal`" raise ValueError(msg) return Expr( lambda plx: plx.max_horizontal( diff --git a/tests/expr_and_series/all_horizontal_test.py b/tests/expr_and_series/all_horizontal_test.py index 98dc9f9f9..01d53fe63 100644 --- a/tests/expr_and_series/all_horizontal_test.py +++ b/tests/expr_and_series/all_horizontal_test.py @@ -87,3 +87,13 @@ def test_horizontal_expressions_emtpy(constructor: Constructor) -> None: ValueError, match=r"At least one expression must be passed.*sum_horizontal" ): df.select(nw.sum_horizontal()) + + with pytest.raises( + ValueError, match=r"At least one expression must be passed.*max_horizontal" + ): + df.select(nw.max_horizontal()) + + with pytest.raises( + ValueError, match=r"At least one expression must be passed.*min_horizontal" + ): + df.select(nw.min_horizontal())