Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: reject hypothesis tests where series construction fails #16714

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion py-polars/polars/testing/parametric/strategies/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
from typing import TYPE_CHECKING, Any, Collection, Mapping, Sequence, overload

import hypothesis.strategies as st
from hypothesis import reject
from hypothesis.errors import InvalidArgument

from polars._utils.deprecation import issue_deprecation_warning
from polars.dataframe import DataFrame
from polars.datatypes import DataType, DataTypeClass, Null
from polars.exceptions import ComputeError
from polars.series import Series
from polars.string_cache import StringCache
from polars.testing.parametric.strategies._utils import flexhash
Expand Down Expand Up @@ -203,7 +205,11 @@ def series( # noqa: D417
)
)

s = Series(name=name, values=values, dtype=dtype)
try:
s = Series(name=name, values=values, dtype=dtype)
except ComputeError as exc:
assert "is ambiguous" in str(exc) or "is non-existent" in str(exc) # noqa: PT017
reject()

# Apply chunking
if allow_chunks and size > 1 and draw(st.booleans()):
Expand Down
Loading