DEV Community

Discussion on: Python TDD with Pytest -- Getting Started

Collapse
 
wzorroman profile image
wzorroman • Edited

import re
import pytest

def check_email_format(email):
if not (re.match(r"([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+$)", email)):
return False
return True

def test_email_exception():
assert check_email_format("good@email.com") == True
assert check_email_format("good.com") == False