From af160085b3febf995e8da7d4f5ea9a45b76df966 Mon Sep 17 00:00:00 2001 From: FBruzzesi Date: Thu, 12 Sep 2024 10:09:55 +0200 Subject: [PATCH 1/2] fix: xfail polars expr mode --- tests/expr_and_series/mode_test.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/expr_and_series/mode_test.py b/tests/expr_and_series/mode_test.py index 33a0bef5a..2fa4266fa 100644 --- a/tests/expr_and_series/mode_test.py +++ b/tests/expr_and_series/mode_test.py @@ -1,5 +1,6 @@ from typing import Any +import polars as pl import pytest import narwhals.stable.v1 as nw @@ -22,7 +23,9 @@ def test_mode_single_expr(constructor: Any, request: Any) -> None: def test_mode_multi_expr(constructor: Any, request: Any) -> None: - if "dask" in str(constructor): + if "dask" in str(constructor) or ( + "polars" in str(constructor) and pl.__version__ >= "1.7.0" + ): request.applymarker(pytest.mark.xfail) df = nw.from_native(constructor(data)) result = df.select(nw.col("a", "b").mode()).sort("a", "b") From f33c09b2b9ad905094344cbfec701ad45a045322 Mon Sep 17 00:00:00 2001 From: FBruzzesi Date: Thu, 12 Sep 2024 11:32:38 +0200 Subject: [PATCH 2/2] use parse_version --- tests/expr_and_series/mode_test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/expr_and_series/mode_test.py b/tests/expr_and_series/mode_test.py index 2fa4266fa..3dd331d29 100644 --- a/tests/expr_and_series/mode_test.py +++ b/tests/expr_and_series/mode_test.py @@ -4,6 +4,7 @@ import pytest import narwhals.stable.v1 as nw +from narwhals.utils import parse_version from tests.utils import compare_dicts data = { @@ -24,7 +25,7 @@ def test_mode_single_expr(constructor: Any, request: Any) -> None: def test_mode_multi_expr(constructor: Any, request: Any) -> None: if "dask" in str(constructor) or ( - "polars" in str(constructor) and pl.__version__ >= "1.7.0" + "polars" in str(constructor) and parse_version(pl.__version__) >= (1, 7, 0) ): request.applymarker(pytest.mark.xfail) df = nw.from_native(constructor(data))