Skip to content

Commit 3992fe3

Browse files
tests: fix collect_with_kwargs for polars nightly (#2527)
* tests: fix collect_with_kwargs for polars nightly * try with QueryOptFlags * add a trailing zero just because.. --------- Co-authored-by: Dan Redding <[email protected]>
1 parent 47c7a94 commit 3992fe3

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/frame/collect_test.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
import narwhals as nw
99
from narwhals.dependencies import get_cudf
1010
from narwhals.dependencies import get_modin
11+
from narwhals.dependencies import get_polars
1112
from narwhals.utils import Implementation
1213
from tests.utils import PANDAS_VERSION
14+
from tests.utils import POLARS_VERSION
1315
from tests.utils import Constructor
1416
from tests.utils import assert_equal_data
1517

@@ -157,8 +159,13 @@ def test_collect_to_invalid_backend(
157159

158160

159161
def test_collect_with_kwargs(constructor: Constructor) -> None:
162+
pl_kwargs = (
163+
{"optimizations": get_polars().QueryOptFlags(predicate_pushdown=False)}
164+
if POLARS_VERSION > (1, 29, 0)
165+
else {"no_optimization": True}
166+
)
160167
collect_kwargs = {
161-
nw.Implementation.POLARS: {"no_optimization": True},
168+
nw.Implementation.POLARS: pl_kwargs,
162169
nw.Implementation.DASK: {"optimize_graph": False},
163170
nw.Implementation.PYARROW: {},
164171
}
@@ -168,7 +175,7 @@ def test_collect_with_kwargs(constructor: Constructor) -> None:
168175
result = (
169176
df.lazy()
170177
.select(nw.col("a", "b").sum())
171-
.collect(**collect_kwargs.get(df.implementation, {})) # type: ignore[arg-type]
178+
.collect(**collect_kwargs.get(df.implementation, {}))
172179
)
173180

174181
expected = {"a": [3], "b": [7]}

0 commit comments

Comments
 (0)