File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -85,11 +85,15 @@ def email(
8585 )
8686 if re .match (
8787 # extended latin
88- r"(^[\u0100-\u017F\u0180-\u024F]"
88+ r"(^[\u0100-\u017F\u0180-\u024F\u00A0-\u00FF ]"
8989 # dot-atom
90- + r"|[-!#$%&'*+/=?^_`{}|~0-9a-z]+(\.[-!#$%&'*+/=?^_`{}|~0-9a-z]+)*$"
90+ + r"|[\u0100-\u017F\u0180-\u024F\u00A0-\u00FF0-9a-z!#$%&'*+/=?^_`{}|~\-]+"
91+ + r"(\.[\u0100-\u017F\u0180-\u024F\u00A0-\u00FF0-9a-z!#$%&'*+/=?^_`{}|~\-]+)*$"
9192 # quoted-string
92- + r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\011.])*"$)' ,
93+ + r'|^"('
94+ + r"[\u0100-\u017F\u0180-\u024F\u00A0-\u00FF\001-\010\013\014\016-\037"
95+ + r"!#-\[\]-\177]|\\[\011.]"
96+ + r')*")$' ,
9397 username_part ,
9498 re .IGNORECASE ,
9599 )
Original file line number Diff line number Diff line change @@ -48,6 +48,9 @@ def test_returns_true_on_valid_email(value: str):
4848 ('"test@test"@example.com' ,),
4949 # Quoted-string format (CR not allowed)
5050 ('"\\ \012 "@here.com' ,),
51+ # Non-quoted space/semicolon not allowed
52+ ("stephen smith@example.com" ,),
53+ ("stephen;smith@example.com" ,),
5154 ],
5255)
5356def test_returns_failed_validation_on_invalid_email (value : str ):
You can’t perform that action at this time.
0 commit comments