1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #28176 -- Restored the uncasted option value in ChoiceWidget template context.

This commit is contained in:
Tim Graham
2017-06-15 11:05:21 -04:00
parent dc63ad7ac0
commit 221e6e1817
5 changed files with 16 additions and 3 deletions

View File

@@ -348,6 +348,12 @@ class SelectTest(WidgetTest):
)
self.assertEqual(index, 2)
def test_optgroups_integer_choices(self):
"""The option 'value' is the same type as what's in `choices`."""
groups = list(self.widget(choices=[[0, 'choice text']]).optgroups('name', ['vhs']))
label, options, index = groups[0]
self.assertEqual(options[0]['value'], 0)
def test_deepcopy(self):
"""
__deepcopy__() should copy all attributes properly (#25085).