diff options
Diffstat (limited to 'tests/model_fields/test_integerfield.py')
| -rw-r--r-- | tests/model_fields/test_integerfield.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/model_fields/test_integerfield.py b/tests/model_fields/test_integerfield.py index 6761589b7e..0d91cff9eb 100644 --- a/tests/model_fields/test_integerfield.py +++ b/tests/model_fields/test_integerfield.py @@ -279,6 +279,14 @@ class ValidationTests(SimpleTestCase): f = models.IntegerField(choices=(("group", ((10, "A"), (20, "B"))), (30, "C"))) self.assertEqual(10, f.clean(10, None)) + def test_choices_validation_supports_named_groups_dicts(self): + f = models.IntegerField(choices={"group": ((10, "A"), (20, "B")), 30: "C"}) + self.assertEqual(10, f.clean(10, None)) + + def test_choices_validation_supports_named_groups_nested_dicts(self): + f = models.IntegerField(choices={"group": {10: "A", 20: "B"}, 30: "C"}) + self.assertEqual(10, f.clean(10, None)) + def test_nullable_integerfield_raises_error_with_blank_false(self): f = models.IntegerField(null=True, blank=False) with self.assertRaises(ValidationError): |
