Ticket #10828: 10828-tests.diff

File 10828-tests.diff, 998 bytes (added by Ramiro Morales, 13 years ago)

Regression tests by Karen and copelco converted to unit test, demonstrates the issue is still present

  • tests/regressiontests/forms/tests/formsets.py

    diff --git a/tests/regressiontests/forms/tests/formsets.py b/tests/regressiontests/forms/tests/formsets.py
    a b  
    381381        formset = CheckFormSet(data, prefix='check')
    382382        self.assertTrue(formset.is_valid())
    383383
     384        # Ticket 10828
     385        # The formset is valid (due to short circuiting forms marked for
     386        # deletion), but not all forms are valid:
     387        self.assertEqual([True, False, True], [form.is_valid() for form in formset.forms])
     388        try:
     389            [form.cleaned_data for form in formset.forms]
     390        except AttributeError, e:
     391            self.fail("Access to formset forms cleaned_data after deletion of forms fails even when formset.is_valid() returns True: %s" % e)
     392
    384393        # If we remove the deletion flag now we will have our validation back.
    385394        data['check-1-DELETE'] = ''
    386395        formset = CheckFormSet(data, prefix='check')
Back to Top