Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_abstract_is_email(self):
v = EmailValidator()
self.assertRaises(NotImplementedError, v.is_email, "test@example.com")
"""Transforms the ASCII control character symbols to their real char.
Note: If the token is not an ASCII control character symbol, just
return the token.
Keyword arguments:
token -- the token to transform
"""
if ord(token) in _range(9216, 9229 + 1):
token = _unichr(ord(token) - 9216)
return token
class ParserValidator(EmailValidator):
def is_email(self, address, diagnose=False):
"""Check that an address address conforms to RFCs 5321, 5322 and others.
More specifically, see the follow RFCs:
* http://tools.ietf.org/html/rfc5321
* http://tools.ietf.org/html/rfc5322
* http://tools.ietf.org/html/rfc4291#section-2.2
* http://tools.ietf.org/html/rfc1123#section-2.1
* http://tools.ietf.org/html/rfc3696) (guidance only)
Keyword arguments:
address -- address to check.
diagnose -- flag to report a diagnosis or a boolean (default False)
"""