def validate(cls, value): ip_utils = IpAddrUtils() if ip_utils.is_valid_ip(value) is False: raise ValueError( 'Invalid IP address format: expected IPv4 or IPv6 address. provided: {}' .format(value)) return value
def test_ipv6_regex_validation(self): ip_utils = IpAddrUtils() for ip_addr in IPv6_ADDRESSES: self.assertTrue(ip_utils.is_valid_ip(ip_addr))