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

def test_add_form_deletion_when_invalid(self):

    PoetFormSet = modelformset_factory(Poet, fields=u'__all__', can_delete=True)
    poet = Poet.objects.create(name=u'test')
    data = {u'form-TOTAL_FORMS': u'3', u'form-INITIAL_FORMS': u'1', u'form-MAX_NUM_FORMS': u'0', u'form-0-id': six.text_type(poet.id), u'form-0-name': u'test', u'form-1-id': u'', u'form-1-name': (u'x' * 1000), u'form-1-id': six.text_type(poet.id), u'form-1-name': u'test2'}
    formset = PoetFormSet(data, queryset=Poet.objects.all())
    self.assertEqual(formset.is_valid(), False)
    self.assertEqual(Poet.objects.count(), 1)
    data[u'form-0-DELETE'] = u'on'
    data[u'form-1-DELETE'] = u'on'
    data[u'form-2-DELETE'] = u'on'
    formset = PoetFormSet(data, queryset=Poet.objects.all())
    self.assertEqual(formset.is_valid(), True)
    formset.save()
    self.assertEqual(Poet.objects.count(), 0)
