Skip to content

Commit 2428594

Browse files
committed
fix(email): complete HU-02 red-green TDD cycle
1 parent c41df7d commit 2428594

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎src/validators/email.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def email(
5555
(Literal[True]): If `value` is a valid eMail.
5656
(ValidationError): If `value` is an invalid eMail.
5757
"""
58-
if not value or value.count("@") != 1:
58+
if not value or "@" not in value:
5959
return False
6060

6161
username_part, domain_part = value.rsplit("@", 1)

‎tests/test_email.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ def test_returns_true_on_valid_email(value: str):
4545
("example@inv-.alid-.com",),
4646
("example@inv-.-alid.com",),
4747
("john56789.john56789.john56789.john56789.john56789.john56789.john5@example.com",),
48-
('"test@test"@example.com',),
4948
# Quoted-string format (CR not allowed)
5049
('"\\\012"@here.com',),
5150
# Non-quoted space/semicolon not allowed

‎tests/test_email_quoted_at_sign.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
@pytest.mark.parametrize(
1010
("email",),
1111
[
12-
('"user@name"@example.com', ),
12+
('"user@name"@example.com',),
13+
('"test@test"@example.com',),
1314
],
1415
)
1516
def test_email_accepts_at_sign_inside_quoted_local_part(email: str):

0 commit comments

Comments
 (0)