Skip to content

Commit

Permalink
remove use of StrEnum
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Sep 4, 2023
1 parent aee915a commit 6becf1a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/validators/test_union.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from enum import StrEnum, auto
from enum import Enum
from uuid import UUID

import pytest
Expand Down Expand Up @@ -485,9 +485,12 @@ def test_left_to_right_union_strict():


def test_union_function_before_called_once():
class SpecialValues(StrEnum):
DEFAULT = auto()
OTHER = auto()
# See https://github.com/pydantic/pydantic/issues/6830 - in particular the
# smart union validator used to call `remove_prefix` twice, which is not
# ideal from a user perspective.
class SpecialValues(str, Enum):
DEFAULT = 'default'
OTHER = 'other'

special_values_schema = core_schema.no_info_after_validator_function(SpecialValues, core_schema.str_schema())

Expand Down

0 comments on commit 6becf1a

Please sign in to comment.