Skip to content

Commit 20af461

Browse files
committed
L07E05
1 parent 15b7d3c commit 20af461

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# https://pypi.org/project/validator-collection/
2+
# https://pypi.org/project/validators/
3+
4+
from validator_collection import checkers
5+
import validators
6+
7+
def main():
8+
print("Valid" if validate(input("What's your email address? ")) else "Invalid")
9+
10+
11+
def validate(email):
12+
return checkers.is_email(email) and validators.email(email)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from response import validate
2+
3+
4+
def test_valid_emails():
5+
assert validate("malan@harvard.edu") == True
6+
assert validate("s123456@studenti.polito.it") == True
7+
assert validate("name.surname@polito.it") == True
8+
assert validate("name_surname@polito.it") == True
9+
10+
11+
def test_invalid_emails():
12+
assert validate("malan@@@harvard.edu") == False
13+
assert validate("malan@harvard..edu") == False

0 commit comments

Comments
 (0)