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 1c0be65
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 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

try:
from enum import StrEnum

PyStrEnum: type[enum.Enum] | None = StrEnum
except ImportError:
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
16 changes: 9 additions & 7 deletions py-polars/tests/unit/functions/test_lit.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

import enum
import sys
from datetime import datetime, timedelta
from decimal import Decimal
from typing import TYPE_CHECKING, Any
Expand All @@ -19,6 +18,14 @@
from polars._typing import PolarsDataType


try:
from enum import StrEnum

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


@pytest.mark.parametrize(
"input",
[
Expand Down Expand Up @@ -109,14 +116,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 1c0be65

Please sign in to comment.