Skip to content

Commit

Permalink
py39, py310 lint
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-beedie committed Dec 6, 2024
1 parent ed030a3 commit 8b60706
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
14 changes: 8 additions & 6 deletions py-polars/tests/unit/datatypes/test_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
)
from polars.testing import assert_frame_equal, assert_series_equal

if sys.version_info >= (3, 11):
from enum import StrEnum

PyStrEnum: type[enum.Enum] | None = StrEnum
else:
PyStrEnum = None


def test_enum_creation() -> None:
dtype = pl.Enum(["a", "b"])
Expand Down Expand Up @@ -617,14 +624,9 @@ def test_enum_19269() -> None:
@pytest.mark.parametrize(
"EnumBase",
[
(enum.Enum,),
(enum.StrEnum,),
(str, enum.Enum),
]
if sys.version_info >= (3, 11)
else [
(enum.Enum,),
(str, enum.Enum),
*([(PyStrEnum,)] if PyStrEnum is not None else []),
],
)
def test_init_frame_from_enums(EnumBase: tuple[type, ...]) -> None:
Expand Down
15 changes: 9 additions & 6 deletions py-polars/tests/unit/functions/test_lit.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
from polars._typing import PolarsDataType


if sys.version_info >= (3, 11):
from enum import StrEnum

PyStrEnum: type[enum.Enum] | None = StrEnum
else:
PyStrEnum = None


@pytest.mark.parametrize(
"input",
[
Expand Down Expand Up @@ -109,14 +117,9 @@ def test_lit_unsupported_type() -> None:
@pytest.mark.parametrize(
"EnumBase",
[
(enum.Enum,),
(enum.StrEnum,),
(str, enum.Enum),
]
if sys.version_info >= (3, 11)
else [
(enum.Enum,),
(str, enum.Enum),
*([(PyStrEnum,)] if PyStrEnum is not None else []),
],
)
def test_lit_enum_input_16668(EnumBase: tuple[type, ...]) -> None:
Expand Down

0 comments on commit 8b60706

Please sign in to comment.