diff --git a/py-polars/requirements-dev.txt b/py-polars/requirements-dev.txt index da532fd13bca..69eaba79960a 100644 --- a/py-polars/requirements-dev.txt +++ b/py-polars/requirements-dev.txt @@ -59,7 +59,7 @@ gevent # ------- hypothesis==6.97.4 -pytest==7.4.0 +pytest==8.0.0 pytest-cov==4.1.0 pytest-xdist==3.5.0 diff --git a/py-polars/tests/unit/operations/map/test_inefficient_map_warning.py b/py-polars/tests/unit/operations/map/test_inefficient_map_warning.py index 3b3b1ffe8966..670299f889bf 100644 --- a/py-polars/tests/unit/operations/map/test_inefficient_map_warning.py +++ b/py-polars/tests/unit/operations/map/test_inefficient_map_warning.py @@ -227,6 +227,7 @@ def test_parse_invalid_function(func: str) -> None: ("col", "func", "expr_repr"), TEST_CASES, ) +@pytest.mark.filterwarnings("ignore:invalid value encountered:RuntimeWarning") def test_parse_apply_functions(col: str, func: str, expr_repr: str) -> None: with pytest.warns( PolarsInefficientMapWarning, @@ -251,11 +252,12 @@ def test_parse_apply_functions(col: str, func: str, expr_repr: str) -> None: ) expected_frame = df.select( x=pl.col(col), - y=pl.col(col).apply(eval(func)), + y=pl.col(col).map_elements(eval(func)), ) assert_frame_equal(result_frame, expected_frame) +@pytest.mark.filterwarnings("ignore:invalid value encountered:RuntimeWarning") def test_parse_apply_raw_functions() -> None: lf = pl.LazyFrame({"a": [1.1, 2.0, 3.4]}) @@ -334,7 +336,7 @@ def x10(self, x: pl.Expr) -> pl.Expr: ): pl_series = pl.Series("srs", [0, 1, 2, 3, 4]) assert_series_equal( - pl_series.apply(lambda x: numpy.cos(3) + x - abs(-1)), + pl_series.map_elements(lambda x: numpy.cos(3) + x - abs(-1)), numpy.cos(3) + pl_series - 1, ) @@ -379,7 +381,7 @@ def test_parse_apply_series( suggested_expression = parser.to_expression(s.name) assert suggested_expression == expr_repr - expected_series = s.apply(func) + expected_series = s.map_elements(func) result_series = eval(suggested_expression) assert_series_equal(expected_series, result_series) 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 bc5eb6eb5e4b..7cdd5fc6c261 100644 --- a/py-polars/tests/unit/operations/map/test_map_elements.py +++ b/py-polars/tests/unit/operations/map/test_map_elements.py @@ -297,6 +297,6 @@ def test_map_elements_on_empty_col_10639() -> None: def test_apply_deprecated() -> None: with pytest.deprecated_call(): - pl.col("a").apply(lambda x: x + 1) + pl.col("a").apply(np.abs) with pytest.deprecated_call(): - pl.Series([1, 2, 3]).apply(lambda x: x + 1) + pl.Series([1, 2, 3]).apply(np.abs)