示例#1
0
def filter_valid_emails(emails):
    valid_emails = []

    for email in emails:
        try:
            validate_email(email)
        except ValueError as exc:
            print(exc)
        else:
            valid_emails.append(email)

    return valid_emails
def test_username_can_contain_letters_and_digits():
    assert validate_email("*****@*****.**") is None
def test_extension_should_contain_only_three_chars():
    assert validate_email("*****@*****.**") is None
def test_extension_invalid_chars_raise_exception():
    with pytest.raises(ValueError):
        validate_email("*****@*****.**")
def test_website_invalid_chars_raise_exception():
    with pytest.raises(ValueError):
        validate_email("abc@website!123.com")
def test_username_can_only_contain_letters():
    assert validate_email("*****@*****.**") is None
def test_website_contain_only_letters_and_digits():
    assert validate_email("*****@*****.**") is None
def test_username_is_invalid_raise_exception():
    with pytest.raises(ValueError):
        validate_email("*****@*****.**")
def test_username_when_dont_start_with_letter_raise_exception():
    with pytest.raises(ValueError):
        validate_email("*****@*****.**")
示例#10
0
def test_username_should_starts_with_letter():
    assert validate_email("*****@*****.**") is None
示例#11
0
def test_username_can_contain_letters_digits_dashes_and_underscores():
    assert validate_email("*****@*****.**") is None