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 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)

This comment has been minimized.

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'}

This comment has been minimized.

Copy link

dmontagu Sep 18, 2019

Author Collaborator

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 samuelcolvin:master Sep 20, 2019
10 checks passed
10 checks passed
Header rules No header rules processed
Pages changed All files already uploaded
Redirect rules No redirect rules processed
Mixed content No mixed content detected
codecov/project 100% (+0%) compared to bc99825
continuous-integration/travis-ci/pr The Travis CI build passed
deploy/netlify Deploy preview ready!
samuelcolvin.pydantic Build #20190918.36 succeeded
samuelcolvin.pydantic (Job Python36) Job Python36 succeeded
samuelcolvin.pydantic (Job Python37) Job Python37 succeeded

This comment has been minimized.

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
2 participants
You can’t perform that action at this time.