Skip to content

Commit

Permalink
Remove no-wildcards groups
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Mar 21, 2024
1 parent bb454e3 commit a4762c2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
4 changes: 0 additions & 4 deletions py-polars/polars/datatypes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
)
from polars.datatypes.constants import (
DATETIME_DTYPES,
DATETIME_DTYPES_NO_WILDCARDS,
DTYPE_TEMPORAL_UNITS,
DURATION_DTYPES,
FLOAT_DTYPES,
Expand All @@ -45,7 +44,6 @@
NUMERIC_DTYPES,
SIGNED_INTEGER_DTYPES,
TEMPORAL_DTYPES,
TEMPORAL_DTYPES_NO_WILDCARDS,
UNSIGNED_INTEGER_DTYPES,
)
from polars.datatypes.constructor import (
Expand Down Expand Up @@ -112,7 +110,6 @@
"Utf8",
# constants
"DATETIME_DTYPES",
"DATETIME_DTYPES_NO_WILDCARDS",
"DTYPE_TEMPORAL_UNITS",
"DURATION_DTYPES",
"FLOAT_DTYPES",
Expand All @@ -122,7 +119,6 @@
"N_INFER_DEFAULT",
"SIGNED_INTEGER_DTYPES",
"TEMPORAL_DTYPES",
"TEMPORAL_DTYPES_NO_WILDCARDS",
"UNSIGNED_INTEGER_DTYPES",
# constructor
"numpy_type_to_constructor",
Expand Down
11 changes: 0 additions & 11 deletions py-polars/polars/datatypes/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@
Datetime("ns", "*"),
]
)
DATETIME_DTYPES_NO_WILDCARDS: frozenset[PolarsDataType] = DataTypeGroup(
[
Datetime,
Datetime("ms"),
Datetime("us"),
Datetime("ns"),
]
)
DURATION_DTYPES: frozenset[PolarsDataType] = DataTypeGroup(
[
Duration,
Expand All @@ -60,9 +52,6 @@
TEMPORAL_DTYPES: frozenset[PolarsTemporalType] = DataTypeGroup(
frozenset([Date, Time]) | DATETIME_DTYPES | DURATION_DTYPES
)
TEMPORAL_DTYPES_NO_WILDCARDS: frozenset[PolarsTemporalType] = DataTypeGroup(
frozenset([Date, Time]) | DATETIME_DTYPES_NO_WILDCARDS | DURATION_DTYPES
)
SIGNED_INTEGER_DTYPES: frozenset[PolarsIntegerType] = DataTypeGroup(
[
Int8,
Expand Down
14 changes: 12 additions & 2 deletions py-polars/tests/unit/series/buffers/test_from_buffers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,20 @@
from hypothesis import given

import polars as pl
from polars.datatypes import TEMPORAL_DTYPES_NO_WILDCARDS
from polars.testing import assert_series_equal
from polars.testing.parametric import series

# TODO: Define data type groups centrally somewhere in the test suite
DATETIME_DTYPES: set[pl.PolarsDataType] = {
pl.Datetime,
pl.Datetime("ms"),
pl.Datetime("us"),
pl.Datetime("ns"),
}
TEMPORAL_DTYPES: set[pl.PolarsDataType] = (
{pl.Date, pl.Time} | pl.DURATION_DTYPES | DATETIME_DTYPES
)


@given(
s=series(
Expand All @@ -35,7 +45,7 @@ def test_series_from_buffers_numeric(s: pl.Series) -> None:
assert_series_equal(s, result)


@given(s=series(allowed_dtypes=TEMPORAL_DTYPES_NO_WILDCARDS, chunked=False))
@given(s=series(allowed_dtypes=TEMPORAL_DTYPES, chunked=False))
def test_series_from_buffers_temporal_with_validity(s: pl.Series) -> None:
validity = s.is_not_null()
physical = pl.Int32 if s.dtype == pl.Date else pl.Int64
Expand Down

0 comments on commit a4762c2

Please sign in to comment.