def test_validate_ipv4(self): self.assertTrue(validator.validate_ipv4('4.2.2.4')) self.assertFalse(validator.validate_ipv4('foobar')) self.assertFalse( validator.validate_ipv4('2001:5a8:4:68e0:e6ce:8fff:fe27:d116')) self.assertFalse(validator.validate_ipv4(123)) self.assertFalse(validator.validate_ipv4(''))
def check_ipv4(self, ipv4): if validate_ipv4(ipv4): if ipv4 in self.get_ipv4_addresses(): return 0 return 1