'Make sure that a change form that is filled out, but marked for deletion
doesn\'t cause validation errors.'

def test_change_form_deletion_when_invalid(self):

    PoemFormSet = inlineformset_factory(Poet, Poem, can_delete=True, fields=u'__all__')
    poet = Poet.objects.create(name=u'test')
    poem = poet.poem_set.create(name=u'test    poem')
    data = {u'poem_set-TOTAL_FORMS': u'1', u'poem_set-INITIAL_FORMS': u'1', u'poem_set-MAX_NUM_FORMS': u'0', u'poem_set-0-id': six.text_type(poem.id), u'poem_set-0-poem': six.text_type(poem.id), u'poem_set-0-name': (u'x' * 1000)}
    formset = PoemFormSet(data, instance=poet)
    self.assertEqual(formset.is_valid(), False)
    self.assertEqual(Poem.objects.count(), 1)
    data[u'poem_set-0-DELETE'] = u'on'
    formset = PoemFormSet(data, instance=poet)
    self.assertEqual(formset.is_valid(), True)
    formset.save()
    self.assertEqual(Poem.objects.count(), 0)
