From 221e6e18177516ac4ac95e40c344b93d14dd607b Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Thu, 15 Jun 2017 11:05:21 -0400 Subject: Fixed #28176 -- Restored the uncasted option value in ChoiceWidget template context. --- tests/forms_tests/widget_tests/test_select.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/forms_tests/widget_tests') diff --git a/tests/forms_tests/widget_tests/test_select.py b/tests/forms_tests/widget_tests/test_select.py index a5201e96e8..beba21fe2d 100644 --- a/tests/forms_tests/widget_tests/test_select.py +++ b/tests/forms_tests/widget_tests/test_select.py @@ -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). -- cgit v1.3