summaryrefslogtreecommitdiff
path: root/tests/model_fields
diff options
context:
space:
mode:
Diffstat (limited to 'tests/model_fields')
-rw-r--r--tests/model_fields/tests.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py
index fb0098a262..45f61a0034 100644
--- a/tests/model_fields/tests.py
+++ b/tests/model_fields/tests.py
@@ -140,6 +140,19 @@ class GetChoicesTests(SimpleTestCase):
f = models.CharField(choices=choices)
self.assertEqual(f.get_choices(include_blank=True), choices)
+ def test_blank_in_grouped_choices(self):
+ choices = [
+ ('f', 'Foo'),
+ ('b', 'Bar'),
+ ('Group', (
+ ('', 'No Preference'),
+ ('fg', 'Foo'),
+ ('bg', 'Bar'),
+ )),
+ ]
+ f = models.CharField(choices=choices)
+ self.assertEqual(f.get_choices(include_blank=True), choices)
+
def test_lazy_strings_not_evaluated(self):
lazy_func = lazy(lambda x: 0 / 0, int) # raises ZeroDivisionError if evaluated.
f = models.CharField(choices=[(lazy_func('group'), (('a', 'A'), ('b', 'B')))])