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 aliases when handling response_fields #159

Conversation

CasperWA
Copy link
Collaborator

@CasperWA CasperWA commented Nov 16, 2020

Fixes #149.
Fixes #157.

When handling response_fields, the dictionary created from the entry pydantic model is created using aliases, i.e., the provider-specific prefix is added correctly to ctime (and future provider-specific fields).
This ensures the resulting entries are correctly presented when response_fields is used.

As a note, there are some optimizations that should be possible when Materials-Consortia/optimade-python-tools#560 has been merged and released.

@codecov
Copy link

codecov bot commented Nov 16, 2020

Codecov Report

Merging #159 (61ed26c) into develop (a2489f3) will increase coverage by 1.64%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #159      +/-   ##
===========================================
+ Coverage    90.59%   92.23%   +1.64%     
===========================================
  Files           28       28              
  Lines         1095     1095              
===========================================
+ Hits           992     1010      +18     
+ Misses         103       85      -18     
Flag Coverage Δ
pytest 92.23% <100.00%> (+1.64%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aiida_optimade/mappers/structures.py 94.44% <ø> (ø)
aiida_optimade/models/structures.py 100.00% <100.00%> (ø)
aiida_optimade/routers/utils.py 96.00% <100.00%> (+21.33%) ⬆️
aiida_optimade/entry_collections.py 93.71% <0.00%> (+1.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a2489f3...61ed26c. Read the comment docs.

@CasperWA CasperWA force-pushed the fix_149_157_properly-handle-provider-specific-fields branch 2 times, most recently from c976f93 to 4ab6c11 Compare November 16, 2020 12:00
New tests for `response_fields` to ensure provider-specific fields are
handled as intended.
This parameter is deprecated as of v1.5.0.
@CasperWA CasperWA force-pushed the fix_149_157_properly-handle-provider-specific-fields branch from 4ab6c11 to 61ed26c Compare November 16, 2020 12:14
@CasperWA CasperWA merged commit 61ed26c into aiidateam:develop Nov 16, 2020
@CasperWA CasperWA deleted the fix_149_157_properly-handle-provider-specific-fields branch November 16, 2020 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant