-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
6 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
from pydantic import BaseSettings, Field | ||
|
||
|
||
class NestedSettings(BaseSettings): | ||
attr: str = Field("attr") | ||
|
||
class ParentSettings(BaseSettings): | ||
|
||
class ParentSettings(BaseSettings): | ||
not_nested_field: str = Field("not_nested_field") | ||
nested_field: NestedSettings = Field(...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
from unittest.mock import ANY | ||
from hooks.gen_docs.gen_docs_env_vars import collect_fields | ||
from tests.utils.resources.nested_base_settings import ParentSettings | ||
from pydantic.fields import FieldInfo | ||
|
||
class TestEnvDocGen: | ||
|
||
class TestEnvDocGen: | ||
def test_collect_fields(self): | ||
collected_field_defaults = [ | ||
"not_nested_field", | ||
"attr", | ||
Ellipsis, | ||
] | ||
collected_defaults = [ | ||
field.field_info.default | ||
for field | ||
in collect_fields(ParentSettings) | ||
field.field_info.default for field in collect_fields(ParentSettings) | ||
] | ||
assert collected_defaults == collected_field_defaults |