summaryrefslogtreecommitdiff
path: root/tests/model_fields
diff options
context:
space:
mode:
Diffstat (limited to 'tests/model_fields')
-rw-r--r--tests/model_fields/tests.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py
index 432984f6bb..60ce13dfb6 100644
--- a/tests/model_fields/tests.py
+++ b/tests/model_fields/tests.py
@@ -68,14 +68,12 @@ class BasicFieldTests(test.TestCase):
self.assertEqual(m._meta.get_field('id').verbose_name, 'verbose pk')
- def test_formclass_with_choices(self):
- # regression for 18162
- class CustomChoiceField(forms.TypedChoiceField):
- pass
- choices = [('a@b.cc', 'a@b.cc'), ('b@b.cc', 'b@b.cc')]
+ def test_choices_form_class(self):
+ """Can supply a custom choices form class. Regression for #20999."""
+ choices = [('a', 'a')]
field = models.CharField(choices=choices)
- klass = CustomChoiceField
- self.assertIsInstance(field.formfield(form_class=klass), klass)
+ klass = forms.TypedMultipleChoiceField
+ self.assertIsInstance(field.formfield(choices_form_class=klass), klass)
class DecimalFieldTests(test.TestCase):