From f3f727d3bc7b5d9b0ad53422773dac24583712c0 Mon Sep 17 00:00:00 2001 From: ritchie Date: Tue, 1 Oct 2024 14:31:21 +0200 Subject: [PATCH] tests --- py-polars/polars/testing/parametric/strategies/dtype.py | 4 ++-- .../tests/unit/operations/namespaces/test_categorical.py | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/py-polars/polars/testing/parametric/strategies/dtype.py b/py-polars/polars/testing/parametric/strategies/dtype.py index fff1ad58c726..35bf4cd55118 100644 --- a/py-polars/polars/testing/parametric/strategies/dtype.py +++ b/py-polars/polars/testing/parametric/strategies/dtype.py @@ -334,9 +334,9 @@ def _time_zones() -> SearchStrategy[str]: ) -def _categorical_orderings() -> SearchStrategy[CategoricalOrdering]: +def _categorical_orderings() -> SearchStrategy[CategoricalOrdering | None]: """Create a strategy for generating valid ordering types for categorical data.""" - return st.sampled_from(["physical", "lexical"]) + return st.sampled_from([None, "lexical"]) @st.composite diff --git a/py-polars/tests/unit/operations/namespaces/test_categorical.py b/py-polars/tests/unit/operations/namespaces/test_categorical.py index 3e491894c18e..b58f9f6cd66d 100644 --- a/py-polars/tests/unit/operations/namespaces/test_categorical.py +++ b/py-polars/tests/unit/operations/namespaces/test_categorical.py @@ -1,3 +1,5 @@ +import warnings + import pytest import polars as pl @@ -146,5 +148,6 @@ def test_cat_uses_lexical_ordering() -> None: s = s.cast(pl.Categorical("lexical")) assert s.cat.uses_lexical_ordering() is True - s = s.cast(pl.Categorical("physical")) - assert s.cat.uses_lexical_ordering() is False + with warnings.catch_warnings(): + s = s.cast(pl.Categorical("physical")) + assert s.cat.uses_lexical_ordering() is False