-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use pydantic==1.8.1 in CI. Update setup.py and OpenAPI schemas accordingly. The latter is needed due to an updated serialization of Enums used in pydantic models in pydantic>=1.7. Add test for get_attribute_fields() method of EntryCollection. Add titles explicitly to fields using Enum types, since when a pydantic model attribute/field specifies an Enum as the type, it doesn't auto-generate the "title" key for the OpenAPI schema. Add doc strings where it was missing for Enums. Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
c282454
commit 574f7b5
Showing
11 changed files
with
85 additions
and
10 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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""Test the EntryCollection abstract base class""" | ||
|
||
|
||
def test_get_attribute_fields(): | ||
"""Test get_attribute_fields() method""" | ||
from optimade.models import ( | ||
LinksResourceAttributes, | ||
ReferenceResourceAttributes, | ||
StructureResourceAttributes, | ||
) | ||
from optimade.server.routers import ENTRY_COLLECTIONS | ||
|
||
entry_name_attributes = { | ||
"links": LinksResourceAttributes, | ||
"references": ReferenceResourceAttributes, | ||
"structures": StructureResourceAttributes, | ||
} | ||
|
||
# Make sure we're hitting all collections | ||
assert set(entry_name_attributes.keys()) == set(ENTRY_COLLECTIONS.keys()) | ||
|
||
for entry_name, attributes_model in entry_name_attributes.items(): | ||
assert ( | ||
set(attributes_model.__fields__.keys()) | ||
== ENTRY_COLLECTIONS[entry_name].get_attribute_fields() | ||
) |