コード例 #1
0
 def test_invalid_newline_after_local_part(self):
     with self.assertRaises(
         ValueError,
         msg="The email address contains invalid characters before the "
         "@-sign: \n.",
     ):
         validate_email_address(u"my\[email protected]")
コード例 #2
0
 def test_invalid_leading_dots(self):
     with self.assertRaises(
         ValueError,
         msg="An email address cannot have a period immediately after the "
         "@-sign.",
     ):
         validate_email_address(u"*****@*****.**")
コード例 #3
0
 def test_invalid_consecutive_dots_in_local_part(self):
     with self.assertRaises(
         ValueError,
         msg="The email address contains invalid characters before the "
         "@-sign: ..",
     ):
         validate_email_address(u"*****@*****.**")
コード例 #4
0
 def test_invalid_newline_in_domain(self):
     with self.assertRaises(
         ValueError,
         msg="The domain name example\n.com contains invalid characters "
         "(Codepoint U+000A at position 8 of 'example\\n' not allowed).",
     ):
         validate_email_address(u"my@example\n.com")
コード例 #5
0
 def test_invalid_two_leading_dots_in_local_part(self):
     with self.assertRaises(
         ValueError,
         msg="The email address contains invalid characters before the "
         "@-sign: ..",
     ):
         validate_email_address(u"*****@*****.**")
コード例 #6
0
 def test_invalid_trailing_dash_component(self):
     with self.assertRaises(
         ValueError,
         msg="The domain name baddash.b-.com contains invalid characters "
         "(Label must not start or end with a hyphen).",
     ):
         validate_email_address(u"*****@*****.**")
コード例 #7
0
 def test_invalid_invalid_character_in_domain(self):
     with self.assertRaises(
         ValueError,
         msg="The domain name ⒈wouldbeinvalid.com contains invalid "
         "characters (Codepoint U+2488 not allowed "
         "at position 1 in '⒈wouldbeinvalid.com').",
     ):
         validate_email_address(u"me@⒈wouldbeinvalid.com")
コード例 #8
0
 def test_invalid_local_part_too_long(self):
     with self.assertRaises(
         ValueError,
         msg="The email address is too long before the @-sign "
         "(2 characters too many).",
     ):
         validate_email_address(
             u"111111111122222222223333333333"
             u"444444444455555555556666666666777777"
             u"@example.com"
         )
コード例 #9
0
 def test_invalid_domain_too_long(self):
     with self.assertRaises(
         ValueError, msg="The email address is too long after the @-sign."
     ):
         validate_email_address(
             u"me"
             u"@1111111111222222222233333333334444444444555555555"
             u".6666666666777777777788888888889999999999000000000"
             u".1111111111222222222233333333334444444444555555555"
             u".6666666666777777777788888888889999999999000000000"
             u".111111111122222222223333333333444444444455555555556"
             u".com"
         )
コード例 #10
0
 def test_invalid_too_long_after_local_part_conversion(self):
     with self.assertRaises(
         ValueError,
         msg="The email address is too long (when encoded in bytes).",
     ):
         validate_email_address(
             u"my.λong.address"
             u"@1111111111222222222233333333334444444444555555555"
             u".6666666666777777777788888888889999999999000000000"
             u".1111111111222222222233333333334444444444555555555"
             u".6666666666777777777788888888889999999999000000000"
             u".111111111122222222223333333333444"
             u".info"
         )
コード例 #11
0
 def test_invalid_too_long(self):
     with self.assertRaises(
         ValueError,
         msg="The email address is too long (2 characters too many).",
     ):
         validate_email_address(
             u"my.long.address"
             u"@1111111111222222222233333333334444444444555555555"
             u".6666666666777777777788888888889999999999000000000"
             u".1111111111222222222233333333334444444444555555555"
             u".6666666666777777777788888888889999999999000000000"
             u".11111111112222222222333333333344444"
             u".info"
         )
コード例 #12
0
 def test_invalid_too_long_after_domain_conversion(self):
     with self.assertRaises(
         ValueError,
         msg="The email address is too long "
         "(when converted to IDNA ASCII).",
     ):
         validate_email_address(
             u"my.long.address"
             u"@λ111111111222222222233333333334444444444555555555"
             u".6666666666777777777788888888889999999999000000000"
             u".1111111111222222222233333333334444444444555555555"
             u".6666666666777777777788888888889999999999000000000"
             u".11111111112222222222333333"
             u".info"
         )
コード例 #13
0
 def test_invalid_too_long_before_local_part_conversion(self):
     with self.assertRaises(
         ValueError,
         msg="The email address is too long "
         "(at least 1 character too many).",
     ):
         validate_email_address(
             u"my.λong.address"
             u"@1111111111222222222233333333334444444444555555555"
             u".6666666666777777777788888888889999999999000000000"
             u".1111111111222222222233333333334444444444555555555"
             u".6666666666777777777788888888889999999999000000000"
             u".1111111111222222222233333333334444"
             u".info"
         )
コード例 #14
0
 def test_valid_devangari_local_part_long(self):
     validate_email_address(u"उदाहरण.परीक्ष@domain.with.idn.tld")
コード例 #15
0
 def test_valid_cyrilic_long(self):
     validate_email_address(u"чебурашкаящик-с-апельсинами.рф@example.com")
コード例 #16
0
 def test_valid_chinese_local_part_long(self):
     validate_email_address(u"甲斐黒川日本@example.com")
コード例 #17
0
 def test_valid_chinese_local_part(self):
     validate_email_address(u"我買@example.com")
コード例 #18
0
 def test_valid_accents(self):
     validate_email_address(u"ñoñó@example.com")
コード例 #19
0
 def test_invalid_mixed_local_part_not_normalized(self):
     with self.assertRaises(
         ValueError, msg="email address is not normalized"
     ):
         validate_email_address(u"jeff葉@臺網中心.tw")
コード例 #20
0
 def test_invalid_all_taiwanese_not_normalized(self):
     with self.assertRaises(
         ValueError, msg="email address is not normalized"
     ):
         validate_email_address(u"葉士豪@臺網中心.台灣")
コード例 #21
0
 def test_valid_mixed_ascii_taiwanese(self):
     validate_email_address(u"jeff@臺網中心.tw")
コード例 #22
0
 def test_valid_mad_symbols_in_local_part(self):
     validate_email_address(u"!#$%&'*+-/=?^_`.{|}[email protected]")
コード例 #23
0
 def test_invalid_missing_local_part(self):
     with self.assertRaises(
         ValueError, msg="There must be something before the @-sign."
     ):
         validate_email_address(u"@example.com")
コード例 #24
0
 def test_valid_chinese(self):
     validate_email_address(u"伊昭傑@郵件.商務")
コード例 #25
0
 def test_valid_greek_mixed(self):
     validate_email_address(u"ιωάννης@εεττ.gr")
コード例 #26
0
 def test_valid_devanagari(self):
     validate_email_address(u"राम@मोहन.ईन्फो")
コード例 #27
0
 def test_valid_simple(self):
     validate_email_address(u"*****@*****.**")
コード例 #28
0
 def test_valid_cyrilic(self):
     validate_email_address(u"юзер@екзампл.ком")
コード例 #29
0
 def test_invalid_consecutive_dots(self):
     with self.assertRaises(
         ValueError,
         msg="An email address cannot have two periods in a row.",
     ):
         validate_email_address(u"*****@*****.**")
コード例 #30
0
 def test_valid_greek(self):
     validate_email_address(u"θσερ@εχαμπλε.ψομ")