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

Add environment parsing support for enums. #252

Merged
merged 2 commits into from
Mar 11, 2024

Conversation

kschwab
Copy link
Contributor

@kschwab kschwab commented Mar 5, 2024

Adds support for environment parsing of enum field names to values.

@kschwab kschwab mentioned this pull request Mar 5, 2024
with pytest.raises(ValidationError):
env.set('FRUIT', 'kiwi')
s = Settings()
assert s.fruit == FruitsEnum.kiwi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this assertion is not needed here

tests/test_settings.py Outdated Show resolved Hide resolved
@hramezani
Copy link
Member

Thanks @kschwab for the new feature implementation.

I left some suggestion

@hramezani
Copy link
Member

please update

Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
@kschwab kschwab requested a review from hramezani March 11, 2024 18:16
@hramezani hramezani merged commit e129a81 into pydantic:main Mar 11, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants