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 EmailStr for Cython #1126

Merged
merged 7 commits into from
Dec 26, 2019

Conversation

koxudaxi
Copy link
Contributor

@koxudaxi koxudaxi commented Dec 24, 2019

Change Summary

This PR fixes EmailStr which is in Compiled Pydantic binary.

Related issue number

#1070

Checklist

  • 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>.md file added describing change
    (see changes/README.md for details)

@codecov
Copy link

codecov bot commented Dec 24, 2019

Codecov Report

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

@@          Coverage Diff           @@
##           master   #1126   +/-   ##
======================================
  Coverage     100%    100%           
======================================
  Files          20      20           
  Lines        3431    3433    +2     
  Branches      663     664    +1     
======================================
+ Hits         3431    3433    +2
Impacted Files Coverage Δ
pydantic/networks.py 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 e65d112...5215b86. Read the comment docs.

Copy link
Member

@samuelcolvin samuelcolvin left a comment

Choose a reason for hiding this comment

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

Looks good, could you please also fix NameEmail and add a test for that too.

changes/1126-koxudaxi.md Outdated Show resolved Hide resolved
Comment on lines -301 to 308
yield str_validator
yield cls.validate

@classmethod
def validate(cls, value: str) -> 'NameEmail':
def validate(cls, value: Any) -> 'NameEmail':
if type(value) == cls:
return value
value = str_validator(value)
return cls(*validate_email(value))
Copy link
Contributor Author

@koxudaxi koxudaxi Dec 26, 2019

Choose a reason for hiding this comment

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

@samuelcolvin

Looks good, could you please also fix NameEmail and add a test for that too.

I found a bug that the validator can't parse NameEmail.
It means NameEmail filed doesn't accept an instance of NameEmail

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
Copy link
Member

@samuelcolvin samuelcolvin left a comment

Choose a reason for hiding this comment

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

sorry, just a few small things. Otherwise LGTM.

pydantic/networks.py Outdated Show resolved Hide resolved
pydantic/networks.py Outdated Show resolved Hide resolved
changes/1126-koxudaxi.md Outdated Show resolved Hide resolved
koxudaxi and others added 3 commits December 27, 2019 02:38
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
@samuelcolvin samuelcolvin merged commit 2b47932 into pydantic:master Dec 26, 2019
@samuelcolvin
Copy link
Member

great thank you.

andreshndz pushed a commit to cuenca-mx/pydantic that referenced this pull request Jan 17, 2020
* Fix EmailStr for Cython

* add a change document.

* Fix NameEmail

* Update changes/1126-koxudaxi.md

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

* Update pydantic/networks.py

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

* Update changes/1126-koxudaxi.md

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

* Update pydantic/networks.py

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants