Пример #1
0
class TestEmailValidator(unittest.TestCase):
    def setUp(self):
        self.validator = EmailValidator()

    def test_valid_emails(self):
        valid_emails = [
            '[email protected]',
            '"Abc\@def"@example.com',
            '"Fred Bloggs"@example.com',
            '"Joe\\Blow"@example.com',
            '"Abc@def"@example.com',
            'customer/[email protected]',
            '\[email protected]',
            '!def!xyz%[email protected]',
            '*****@*****.**',
            '*****@*****.**',
            'mimimi@президент.рф'
        ]
        for email in valid_emails:
            assert self.validator.validate(email)

    def test_invalid_emails(self):
        invalid_emails = ['email.r', '&&&abir@valg']
        for email in invalid_emails:
            assert not self.validator.validate(email)
Пример #2
0
class TestEmailValidator(unittest.TestCase):
    def setUp(self):
        self.validator = EmailValidator()

    def test_valid_emails(self):
        valid_emails = [
            '[email protected]', '"Abc\@def"@example.com',
            '"Fred Bloggs"@example.com', '"Joe\\Blow"@example.com',
            '"Abc@def"@example.com',
            'customer/[email protected]', '\[email protected]',
            '!def!xyz%[email protected]', '*****@*****.**',
            '*****@*****.**', 'mimimi@президент.рф'
        ]
        for email in valid_emails:
            assert self.validator.validate(email)

    def test_invalid_emails(self):
        invalid_emails = ['email.r', '&&&abir@valg']
        for email in invalid_emails:
            assert not self.validator.validate(email)
Пример #3
0
 def setUp(self):
     self.validator = EmailValidator()
Пример #4
0
 class TD(BaseDoc):
     field1 = StringField(validators=[EmailValidator()])
Пример #5
0
 def setUp(self):
     self.validator = EmailValidator()