diff options
| author | Tim Graham <timograham@gmail.com> | 2015-01-17 20:42:41 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-01-19 11:12:57 -0500 |
| commit | 33457cd3b0da69320d3f66bb6d5a673950c5032f (patch) | |
| tree | c69fca5e8972e75e15c800901984c017e69ca708 /tests/forms_tests | |
| parent | 5008a4db440c8f7d108a6979b959025ffb5789ba (diff) | |
Removed IPAddressField per deprecation timeline; refs #20439.
Diffstat (limited to 'tests/forms_tests')
| -rw-r--r-- | tests/forms_tests/tests/test_error_messages.py | 15 | ||||
| -rw-r--r-- | tests/forms_tests/tests/test_extra.py | 29 |
2 files changed, 6 insertions, 38 deletions
diff --git a/tests/forms_tests/tests/test_error_messages.py b/tests/forms_tests/tests/test_error_messages.py index 798f11ba1a..5f79d4aa95 100644 --- a/tests/forms_tests/tests/test_error_messages.py +++ b/tests/forms_tests/tests/test_error_messages.py @@ -5,12 +5,11 @@ from django.core.files.uploadedfile import SimpleUploadedFile from django.forms import ( BooleanField, CharField, ChoiceField, DateField, DateTimeField, DecimalField, EmailField, FileField, FloatField, Form, - GenericIPAddressField, IntegerField, IPAddressField, ModelChoiceField, + GenericIPAddressField, IntegerField, ModelChoiceField, ModelMultipleChoiceField, MultipleChoiceField, RegexField, SplitDateTimeField, TimeField, URLField, utils, ValidationError, ) -from django.test import ignore_warnings, TestCase -from django.utils.deprecation import RemovedInDjango19Warning +from django.test import TestCase from django.utils.safestring import mark_safe from django.utils.encoding import python_2_unicode_compatible @@ -197,16 +196,6 @@ class FormsErrorMessagesTestCase(TestCase, AssertFormErrorsMixin): self.assertFormErrors(['REQUIRED'], f.clean, '') self.assertFormErrors(['INVALID DATE', 'INVALID TIME'], f.clean, ['a', 'b']) - @ignore_warnings(category=RemovedInDjango19Warning) - def test_ipaddressfield(self): - e = { - 'required': 'REQUIRED', - 'invalid': 'INVALID IP ADDRESS', - } - f = IPAddressField(error_messages=e) - self.assertFormErrors(['REQUIRED'], f.clean, '') - self.assertFormErrors(['INVALID IP ADDRESS'], f.clean, '127.0.0') - def test_generic_ipaddressfield(self): e = { 'required': 'REQUIRED', diff --git a/tests/forms_tests/tests/test_extra.py b/tests/forms_tests/tests/test_extra.py index d172e17cd9..5599ec6ccf 100644 --- a/tests/forms_tests/tests/test_extra.py +++ b/tests/forms_tests/tests/test_extra.py @@ -5,17 +5,16 @@ import datetime from django.forms import ( CharField, DateField, EmailField, FileField, Form, GenericIPAddressField, - HiddenInput, ImageField, IPAddressField, MultipleChoiceField, - MultiValueField, MultiWidget, PasswordInput, SelectMultiple, SlugField, - SplitDateTimeField, SplitDateTimeWidget, TextInput, URLField, + HiddenInput, ImageField, MultipleChoiceField, MultiValueField, MultiWidget, + PasswordInput, SelectMultiple, SlugField, SplitDateTimeField, + SplitDateTimeWidget, TextInput, URLField, ) from django.forms.extras import SelectDateWidget from django.forms.utils import ErrorList -from django.test import TestCase, ignore_warnings, override_settings +from django.test import TestCase, override_settings from django.utils import six from django.utils import translation from django.utils.dates import MONTHS_AP -from django.utils.deprecation import RemovedInDjango19Warning from django.utils.encoding import force_text, smart_text, python_2_unicode_compatible from .test_error_messages import AssertFormErrorsMixin @@ -483,26 +482,6 @@ class FormsExtraTestCase(TestCase, AssertFormErrorsMixin): self.assertEqual(f.cleaned_data['field1'], 'some text,JP,2007-04-25 06:24:00') - @ignore_warnings(category=RemovedInDjango19Warning) - def test_ipaddress(self): - f = IPAddressField() - self.assertFormErrors(['This field is required.'], f.clean, '') - self.assertFormErrors(['This field is required.'], f.clean, None) - self.assertEqual(f.clean(' 127.0.0.1'), '127.0.0.1') - self.assertFormErrors(['Enter a valid IPv4 address.'], f.clean, 'foo') - self.assertFormErrors(['Enter a valid IPv4 address.'], f.clean, '127.0.0.') - self.assertFormErrors(['Enter a valid IPv4 address.'], f.clean, '1.2.3.4.5') - self.assertFormErrors(['Enter a valid IPv4 address.'], f.clean, '256.125.1.5') - - f = IPAddressField(required=False) - self.assertEqual(f.clean(''), '') - self.assertEqual(f.clean(None), '') - self.assertEqual(f.clean(' 127.0.0.1'), '127.0.0.1') - self.assertFormErrors(['Enter a valid IPv4 address.'], f.clean, 'foo') - self.assertFormErrors(['Enter a valid IPv4 address.'], f.clean, '127.0.0.') - self.assertFormErrors(['Enter a valid IPv4 address.'], f.clean, '1.2.3.4.5') - self.assertFormErrors(['Enter a valid IPv4 address.'], f.clean, '256.125.1.5') - def test_generic_ipaddress_invalid_arguments(self): self.assertRaises(ValueError, GenericIPAddressField, protocol="hamster") self.assertRaises(ValueError, GenericIPAddressField, protocol="ipv4", unpack_ipv4=True) |
