diff options
| author | Tim Graham <timograham@gmail.com> | 2016-12-31 10:30:41 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-01-17 20:52:02 -0500 |
| commit | bcf3532ede16407f1a701717deaed835eda3e87b (patch) | |
| tree | d4b6167d5c47c42fcae8f05dd86b03adb7faa33c /tests/model_forms | |
| parent | bc3540ce2c7cc59ec39a23ed16b14cc12f485bf3 (diff) | |
Refs #26154 -- Removed deprecated CommaSeparatedIntegerField.
Diffstat (limited to 'tests/model_forms')
| -rw-r--r-- | tests/model_forms/models.py | 8 | ||||
| -rw-r--r-- | tests/model_forms/tests.py | 41 |
2 files changed, 6 insertions, 43 deletions
diff --git a/tests/model_forms/models.py b/tests/model_forms/models.py index f873cfea97..3675e080fa 100644 --- a/tests/model_forms/models.py +++ b/tests/model_forms/models.py @@ -218,14 +218,6 @@ except ImportError: test_images = False -@python_2_unicode_compatible -class CommaSeparatedInteger(models.Model): - field = models.CommaSeparatedIntegerField(max_length=20) - - def __str__(self): - return self.field - - class Homepage(models.Model): url = models.URLField() diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py index 1686629c3a..ef808f72f5 100644 --- a/tests/model_forms/tests.py +++ b/tests/model_forms/tests.py @@ -24,12 +24,12 @@ from django.utils._os import upath from .models import ( Article, ArticleStatus, Author, Author1, Award, BetterWriter, BigInt, Book, - Category, Character, Colour, ColourfulItem, CommaSeparatedInteger, - CustomErrorMessage, CustomFF, CustomFieldForExclusionModel, DateTimePost, - DerivedBook, DerivedPost, Document, ExplicitPK, FilePathModel, - FlexibleDatePost, Homepage, ImprovedArticle, ImprovedArticleWithParentLink, - Inventory, NullableUniqueCharFieldModel, Person, Photo, Post, Price, - Product, Publication, PublicationDefaults, StrictAssignmentAll, + Category, Character, Colour, ColourfulItem, CustomErrorMessage, CustomFF, + CustomFieldForExclusionModel, DateTimePost, DerivedBook, DerivedPost, + Document, ExplicitPK, FilePathModel, FlexibleDatePost, Homepage, + ImprovedArticle, ImprovedArticleWithParentLink, Inventory, + NullableUniqueCharFieldModel, Person, Photo, Post, Price, Product, + Publication, PublicationDefaults, StrictAssignmentAll, StrictAssignmentFieldSpecific, Student, StumpJoke, TextFile, Triple, Writer, WriterProfile, test_images, ) @@ -2411,35 +2411,6 @@ class ModelOtherFieldTests(SimpleTestCase): self.assertFalse(bif.is_valid()) self.assertEqual(bif.errors, {'biggie': ['Ensure this value is less than or equal to 9223372036854775807.']}) - def test_comma_separated_integer_field(self): - class CommaSeparatedIntegerForm(forms.ModelForm): - class Meta: - model = CommaSeparatedInteger - fields = '__all__' - - f = CommaSeparatedIntegerForm({'field': '1'}) - self.assertTrue(f.is_valid()) - self.assertEqual(f.cleaned_data, {'field': '1'}) - f = CommaSeparatedIntegerForm({'field': '12'}) - self.assertTrue(f.is_valid()) - self.assertEqual(f.cleaned_data, {'field': '12'}) - f = CommaSeparatedIntegerForm({'field': '1,2,3'}) - self.assertTrue(f.is_valid()) - self.assertEqual(f.cleaned_data, {'field': '1,2,3'}) - f = CommaSeparatedIntegerForm({'field': '10,32'}) - self.assertTrue(f.is_valid()) - self.assertEqual(f.cleaned_data, {'field': '10,32'}) - f = CommaSeparatedIntegerForm({'field': '1a,2'}) - self.assertEqual(f.errors, {'field': ['Enter only digits separated by commas.']}) - f = CommaSeparatedIntegerForm({'field': ',,,,'}) - self.assertEqual(f.errors, {'field': ['Enter only digits separated by commas.']}) - f = CommaSeparatedIntegerForm({'field': '1.2'}) - self.assertEqual(f.errors, {'field': ['Enter only digits separated by commas.']}) - f = CommaSeparatedIntegerForm({'field': '1,a,2'}) - self.assertEqual(f.errors, {'field': ['Enter only digits separated by commas.']}) - f = CommaSeparatedIntegerForm({'field': '1,,2'}) - self.assertEqual(f.errors, {'field': ['Enter only digits separated by commas.']}) - def test_url_on_modelform(self): "Check basic URL field validation on model forms" class HomepageForm(forms.ModelForm): |
