Пример #1
0
 def test_incorrect_plain_address(self):
     """Test that incorrect addresses fail to validate."""
     self.assertFalse(is_valid_ipv6_address("foo"))
     self.assertFalse(is_valid_ipv6_address("127.0.0.1"))
     self.assertFalse(is_valid_ipv6_address("12345::"))
     self.assertFalse(is_valid_ipv6_address("1::2:3::4"))
     self.assertFalse(is_valid_ipv6_address("1::zzz"))
     self.assertFalse(is_valid_ipv6_address("1::2:3:4:5:6:7:8"))
     self.assertFalse(is_valid_ipv6_address("1:2"))
     self.assertFalse(is_valid_ipv6_address("1:::2"))
Пример #2
0
 def test_incorrect_plain_address(self):
     """Test that incorrect addresses fail to validate."""
     self.assertFalse(is_valid_ipv6_address('foo'))
     self.assertFalse(is_valid_ipv6_address('127.0.0.1'))
     self.assertFalse(is_valid_ipv6_address('12345::'))
     self.assertFalse(is_valid_ipv6_address('1::2:3::4'))
     self.assertFalse(is_valid_ipv6_address('1::zzz'))
     self.assertFalse(is_valid_ipv6_address('1::2:3:4:5:6:7:8'))
     self.assertFalse(is_valid_ipv6_address('1:2'))
     self.assertFalse(is_valid_ipv6_address('1:::2'))
Пример #3
0
 def test_correct_plain_address(self):
     """Test simple IPv6 address validation."""
     self.assertTrue(is_valid_ipv6_address('fe80::223:6cff:fe8a:2e8a'))
     self.assertTrue(is_valid_ipv6_address('2a02::223:6cff:fe8a:2e8a'))
     self.assertTrue(is_valid_ipv6_address('1::2:3:4:5:6:7'))
     self.assertTrue(is_valid_ipv6_address('::'))
     self.assertTrue(is_valid_ipv6_address('::a'))
     self.assertTrue(is_valid_ipv6_address('2::'))
Пример #4
0
 def test_correct_plain_address(self):
     """Test simple IPv6 address validation."""
     self.assertTrue(is_valid_ipv6_address("fe80::223:6cff:fe8a:2e8a"))
     self.assertTrue(is_valid_ipv6_address("2a02::223:6cff:fe8a:2e8a"))
     self.assertTrue(is_valid_ipv6_address("1::2:3:4:5:6:7"))
     self.assertTrue(is_valid_ipv6_address("::"))
     self.assertTrue(is_valid_ipv6_address("::a"))
     self.assertTrue(is_valid_ipv6_address("2::"))
Пример #5
0
 def test_incorrect_with_v4mapping(self):
     """Test that incorrect mapped addresses fail to validate."""
     self.assertFalse(is_valid_ipv6_address('::ffff:999.42.16.14'))
     self.assertFalse(is_valid_ipv6_address('::ffff:zzzz:0a0a'))
     # The ::1.2.3.4 format used to be valid but was deprecated
     # in rfc4291 section 2.5.5.1
     self.assertTrue(is_valid_ipv6_address('::254.42.16.14'))
     self.assertTrue(is_valid_ipv6_address('::0a0a:0a0a'))
     self.assertFalse(is_valid_ipv6_address('::999.42.16.14'))
     self.assertFalse(is_valid_ipv6_address('::zzzz:0a0a'))
Пример #6
0
 def test_incorrect_with_v4mapping(self):
     """Test that incorrect mapped addresses fail to validate."""
     self.assertFalse(is_valid_ipv6_address("::ffff:999.42.16.14"))
     self.assertFalse(is_valid_ipv6_address("::ffff:zzzz:0a0a"))
     # The ::1.2.3.4 format used to be valid but was deprecated
     # in rfc4291 section 2.5.5.1
     self.assertTrue(is_valid_ipv6_address("::254.42.16.14"))
     self.assertTrue(is_valid_ipv6_address("::0a0a:0a0a"))
     self.assertFalse(is_valid_ipv6_address("::999.42.16.14"))
     self.assertFalse(is_valid_ipv6_address("::zzzz:0a0a"))
Пример #7
0
 def test_correct_with_v4mapping(self):
     """Test mapped IPv6 address validation."""
     self.assertTrue(is_valid_ipv6_address('::ffff:254.42.16.14'))
     self.assertTrue(is_valid_ipv6_address('::ffff:0a0a:0a0a'))
Пример #8
0
 def test_correct_with_v4mapping(self):
     """Test mapped IPv6 address validation."""
     self.assertTrue(is_valid_ipv6_address("::ffff:254.42.16.14"))
     self.assertTrue(is_valid_ipv6_address("::ffff:0a0a:0a0a"))