コード例 #1
0
ファイル: test_utils.py プロジェクト: bigdig/swift
 def test_is_valid_ipv4(self):
     self.assertTrue(is_valid_ipv4("127.0.0.1"))
     self.assertTrue(is_valid_ipv4("10.0.0.1"))
     ipv6 = "fe80:0000:0000:0000:0204:61ff:fe9d:f156"
     self.assertFalse(is_valid_ipv4(ipv6))
     ipv6 = "fe80:0:0:0:204:61ff:fe9d:f156"
     self.assertFalse(is_valid_ipv4(ipv6))
     ipv6 = "fe80::204:61ff:fe9d:f156"
     self.assertFalse(is_valid_ipv4(ipv6))
     ipv6 = "fe80:0000:0000:0000:0204:61ff:254.157.241.86"
     self.assertFalse(is_valid_ipv4(ipv6))
     ipv6 = "fe80:0:0:0:0204:61ff:254.157.241.86"
     self.assertFalse(is_valid_ipv4(ipv6))
     ipv6 = "fe80::204:61ff:254.157.241.86"
     self.assertFalse(is_valid_ipv4(ipv6))
     ipv6 = "fe80::"
     self.assertFalse(is_valid_ipv4(ipv6))
     ipv6 = "::1"
     self.assertFalse(is_valid_ipv4(ipv6))
     not_ipv6 = "3ffe:0b00:0000:0001:0000:0000:000a"
     self.assertFalse(is_valid_ipv4(not_ipv6))
     not_ipv6 = "1:2:3:4:5:6::7:8"
     self.assertFalse(is_valid_ipv4(not_ipv6))
コード例 #2
0
ファイル: test_utils.py プロジェクト: PrinceKumar001/swift-2
 def test_is_valid_ipv4(self):
     self.assertTrue(is_valid_ipv4("127.0.0.1"))
     self.assertTrue(is_valid_ipv4("10.0.0.1"))
     ipv6 = "fe80:0000:0000:0000:0204:61ff:fe9d:f156"
     self.assertFalse(is_valid_ipv4(ipv6))
     ipv6 = "fe80:0:0:0:204:61ff:fe9d:f156"
     self.assertFalse(is_valid_ipv4(ipv6))
     ipv6 = "fe80::204:61ff:fe9d:f156"
     self.assertFalse(is_valid_ipv4(ipv6))
     ipv6 = "fe80:0000:0000:0000:0204:61ff:254.157.241.86"
     self.assertFalse(is_valid_ipv4(ipv6))
     ipv6 = "fe80:0:0:0:0204:61ff:254.157.241.86"
     self.assertFalse(is_valid_ipv4(ipv6))
     ipv6 = "fe80::204:61ff:254.157.241.86"
     self.assertFalse(is_valid_ipv4(ipv6))
     ipv6 = "fe80::"
     self.assertFalse(is_valid_ipv4(ipv6))
     ipv6 = "::1"
     self.assertFalse(is_valid_ipv4(ipv6))
     not_ipv6 = "3ffe:0b00:0000:0001:0000:0000:000a"
     self.assertFalse(is_valid_ipv4(not_ipv6))
     not_ipv6 = "1:2:3:4:5:6::7:8"
     self.assertFalse(is_valid_ipv4(not_ipv6))