Skip to content

Commit

Permalink
polars fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Feb 18, 2025
1 parent f0c4e29 commit 4966c9d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion narwhals/_dask/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def maybe_evaluate_expr(df: DaskLazyFrame, obj: DaskExpr | object) -> dx.Series
results = obj._call(df)
if len(results) != 1:
msg = "Multi-output expressions (e.g. `nw.all()` or `nw.col('a', 'b')`) not supported in this context"
raise ValueError(msg)
raise AssertionError(msg)
return results[0]
return obj

Expand Down
8 changes: 6 additions & 2 deletions tests/frame/invalid_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@
def test_all_vs_all(constructor: Constructor) -> None:
data = {"a": [1, 3, 2], "b": [4, 4, 6]}
df: Frame = nw.from_native(constructor(data))
with pytest.raises(ValueError, match="Multi-output"):
df.select(nw.all() + nw.all())
with pytest.raises(
(ValueError, AssertionError),
match=r"Multi-output|Expr: \*\' not allowed in this context",
):
# Polars raises AssertionError.
df.lazy().select(nw.all() + nw.col("b", "a")).collect()


def test_invalid() -> None:
Expand Down

0 comments on commit 4966c9d

Please sign in to comment.