'Test that GenericIPAddressField with a specified protocol does not
generate a formfield with no specified protocol. See #20740.'

def test_genericipaddressfield_formfield_protocol(self):

    model_field = models.GenericIPAddressField(protocol=u'IPv4')
    form_field = model_field.formfield()
    self.assertRaises(ValidationError, form_field.clean, u'::1')
    model_field = models.GenericIPAddressField(protocol=u'IPv6')
    form_field = model_field.formfield()
    self.assertRaises(ValidationError, form_field.clean, u'127.0.0.1')
