From fa5c754f29d7bab38e19384e5a1ba88712fafa30 Mon Sep 17 00:00:00 2001 From: Orson Peters Date: Wed, 2 Oct 2024 10:28:16 +0200 Subject: [PATCH] fix/skip some final tests --- .../tests/unit/datatypes/test_decimal.py | 73 ++++++++++--------- py-polars/tests/unit/test_queries.py | 2 + 2 files changed, 42 insertions(+), 33 deletions(-) diff --git a/py-polars/tests/unit/datatypes/test_decimal.py b/py-polars/tests/unit/datatypes/test_decimal.py index dd61f150ef75..da7e8e5e0daf 100644 --- a/py-polars/tests/unit/datatypes/test_decimal.py +++ b/py-polars/tests/unit/datatypes/test_decimal.py @@ -322,45 +322,52 @@ def test_decimal_aggregations() -> None: "max": [D("10.10"), D("9000.12")], } - assert df.select( + res = df.select( sum=pl.sum("a"), min=pl.min("a"), max=pl.max("a"), mean=pl.mean("a"), median=pl.median("a"), - ).to_dict(as_series=False) == { - "sum": [D("9110.33")], - "min": [D("0.10")], - "max": [D("9000.12")], - "mean": [2277.5825], - "median": [55.055], - } + ) + expected = pl.DataFrame( + { + "sum": [D("9110.33")], + "min": [D("0.10")], + "max": [D("9000.12")], + "mean": [2277.5825], + "median": [55.055], + } + ) + assert_frame_equal(res, expected) - assert df.describe().to_dict(as_series=False) == { - "statistic": [ - "count", - "null_count", - "mean", - "std", - "min", - "25%", - "50%", - "75%", - "max", - ], - "g": [4.0, 0.0, 1.5, 0.5773502691896257, 1.0, 1.0, 2.0, 2.0, 2.0], - "a": [ - 4.0, - 0.0, - 2277.5825, - 4481.916846516863, - 0.1, - 10.1, - 100.01, - 100.01, - 9000.12, - ], - } + description = pl.DataFrame( + { + "statistic": [ + "count", + "null_count", + "mean", + "std", + "min", + "25%", + "50%", + "75%", + "max", + ], + "g": [4.0, 0.0, 1.5, 0.5773502691896257, 1.0, 1.0, 2.0, 2.0, 2.0], + "a": [ + 4.0, + 0.0, + 2277.5825, + 4481.916846516863, + 0.1, + 10.1, + 100.01, + 100.01, + 9000.12, + ], + } + ) + assert_frame_equal(df.describe(), description) def test_decimal_df_vertical_sum() -> None: diff --git a/py-polars/tests/unit/test_queries.py b/py-polars/tests/unit/test_queries.py index 4c50a183af49..4ed09d7dbf1f 100644 --- a/py-polars/tests/unit/test_queries.py +++ b/py-polars/tests/unit/test_queries.py @@ -4,6 +4,7 @@ import numpy as np import pandas as pd +import pytest import polars as pl from polars.testing import assert_frame_equal @@ -110,6 +111,7 @@ def test_maintain_order_after_sampling() -> None: assert result.to_dict(as_series=False) == expected +@pytest.mark.may_fail_auto_streaming def test_sorted_group_by_optimization() -> None: df = pl.DataFrame({"a": np.random.randint(0, 5, 20)})