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

Use pydantic to validate config #7

Merged
merged 1 commit into from
Jul 7, 2023

Conversation

eggmaster
Copy link
Collaborator

We can use pydantic to ensure that the expected config values are present. This is an improvement over the existing use of 'assert' statements.

Also adds some unit tests for the new validation.

Copy link

@jpichon jpichon left a comment

Choose a reason for hiding this comment

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

Tiny nit question inline, otherwise lgtm! As someone not very familiar with pydantic yet, I really appreciate the tests to illustrate what the options and flags mean. It's neat.

tests/unit/test_config.py Outdated Show resolved Hide resolved
tests/unit/test_config.py Outdated Show resolved Hide resolved
tests/unit/test_config.py Outdated Show resolved Hide resolved
Copy link
Member

@jguiditta jguiditta left a comment

Choose a reason for hiding this comment

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

Aside from feeling like dict-naming in some of the tests is a bit confusing, overall, I like the changes. Good abstraction to avoid repetition and lock down the validation, along with thorough tests to show how it all works!

tests/unit/test_config.py Outdated Show resolved Hide resolved
We can use pydantic to ensure that the expected config values are present. This
is an improvement over the existing use of 'assert' statements.

Also adds some unit tests for the new validation.
@jguiditta jguiditta merged commit 601370d into release-depot:main Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants