From c09bf8d76770d39a4d9545b67598cd05adee281b Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Sat, 15 Apr 2017 13:01:38 -0400 Subject: Fixed #28058 -- Restored empty BoundFields evaluating to True. Regression in b52c73008a9d67e9ddbb841872dc15cdd3d6ee01 --- tests/forms_tests/tests/test_forms.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/forms_tests') diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py index 2466bbc67b..9f32953b47 100644 --- a/tests/forms_tests/tests/test_forms.py +++ b/tests/forms_tests/tests/test_forms.py @@ -746,6 +746,13 @@ Java [str(bf[1]), str(bf[2]), str(bf[3])], ) + def test_boundfield_bool(self): + """BoundField without any choices (subwidgets) evaluates to True.""" + class TestForm(Form): + name = ChoiceField(choices=[]) + + self.assertIs(bool(TestForm()['name']), True) + def test_forms_with_multiple_choice(self): # MultipleChoiceField is a special case, as its data is required to be a list: class SongForm(Form): -- cgit v1.3