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

Fix raised ValidationError for model-type fields #820

merged 1 commit into from Sep 20, 2019


Copy link

@dmontagu dmontagu commented Sep 18, 2019

Change Summary

Fixes the one issue discovered while working on #812 that we want to include in v1


  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • Documentation reflects the changes where applicable
  • changes/<pull request or issue id>-<github username>.rst file added describing change
    (see changes/ for details)

Copy link

codecov bot commented Sep 18, 2019

Codecov Report

Merging #820 into master will not change coverage.
The diff coverage is 100%.

@@          Coverage Diff          @@
##           master   #820   +/-   ##
  Coverage     100%   100%           
  Files          17     17           
  Lines        3023   3024    +1     
  Branches      582    582           
+ Hits         3023   3024    +1
Impacted Files Coverage Δ
pydantic/ 100% <100%> (ø) ⬆️

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 bc99825...f6ee524. Read the comment docs.

with pytest.raises(ValidationError) as exc_info:
assert exc_info.value.errors() == [
{'loc': ('submodel', 'x'), 'msg': 'value is not a valid integer', 'type': 'type_error.integer'}
Copy link
Collaborator Author

@dmontagu dmontagu Sep 18, 2019

Choose a reason for hiding this comment

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

Without the change to BaseModel.validate, this is a type_error.dict with loc ('submodel',)

@samuelcolvin samuelcolvin added this to the Version 1 milestone Sep 20, 2019
@samuelcolvin samuelcolvin merged commit cccf39e into pydantic:master Sep 20, 2019
10 checks passed
Copy link

samuelcolvin commented Sep 20, 2019

great, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants