diff --git a/py-polars/polars/expr/expr.py b/py-polars/polars/expr/expr.py index 7d3f338d2a43..0321e78759f8 100644 --- a/py-polars/polars/expr/expr.py +++ b/py-polars/polars/expr/expr.py @@ -4411,7 +4411,8 @@ def get_lazy_promise(df: DataFrame) -> LazyFrame: wrap_threading, agg_list=True, return_dtype=return_dtype ) else: - ValueError(f"Strategy {strategy} is not supported.") + msg = f"strategy {strategy!r} is not supported" + raise ValueError(msg) def flatten(self) -> Self: """ diff --git a/py-polars/tests/unit/operations/map/test_map_elements.py b/py-polars/tests/unit/operations/map/test_map_elements.py index 7cdd5fc6c261..3b5f67fc18e7 100644 --- a/py-polars/tests/unit/operations/map/test_map_elements.py +++ b/py-polars/tests/unit/operations/map/test_map_elements.py @@ -300,3 +300,11 @@ def test_apply_deprecated() -> None: pl.col("a").apply(np.abs) with pytest.deprecated_call(): pl.Series([1, 2, 3]).apply(np.abs) + + +def test_cabbage_strategy_14396() -> None: + df = pl.DataFrame({"x": [1, 2, 3]}) + with pytest.raises( + ValueError, match="strategy 'cabbage' is not supported" + ), pytest.warns(PolarsInefficientMapWarning): + df.select(pl.col("x").map_elements(lambda x: 2 * x, strategy="cabbage")) # type: ignore[arg-type]