'If the user submits a new file upload AND checks the clear checkbox,
they get a validation error, and the bound redisplay of the form still
includes the current file and the clear checkbox.'

def test_clear_and_file_contradiction(self):

    form = DocumentForm(files={'myfile': SimpleUploadedFile('something.txt', 'content')})
    self.assertTrue(form.is_valid())
    doc = form.save(commit=False)
    form = DocumentForm(instance=doc, files={'myfile': SimpleUploadedFile('something.txt', 'content')}, data={'myfile-clear': 'true'})
    self.assertTrue((not form.is_valid()))
    self.assertEqual(form.errors['myfile'], [u'Please    either    submit    a    file    or    check    the    clear    checkbox,    not    both.'])
    rendered = unicode(form)
    self.assertTrue(('something.txt' in rendered))
    self.assertTrue(('myfile-clear' in rendered))
