I am completely stuck here. Why does this test fail?
class BogusForm(forms.Form):
bogus_bool = forms.BooleanField()
class TestBogusForm(TestCase):
def test_bogus_false(self):
query_dict = QueryDict('', mutable=True)
query_dict.update({'bogus_bool': False})
bogus_form = BogusForm(query_dict)
self.assertTrue(bogus_form.is_valid())
Verification of the form field failed , but only if bogus_bool is False when updating QueryDict . If I say:
query_dict.update({'bogus_bool': True})
Then he passes the test. What's going on here? Is this a bug in Django Forms?
If I look at QueryDict before passing it to the BogusForm constructor, it looks like this:
<QueryDict: {u'bogus_bool': [False]}>
Which looks completely legal and right for me.
slacy source
share