Fixed #8196 -- Make the model_form tests also pass if you don't have PIL

installed. We weren't relying on PIL previously, but the output was different
if it wasn't installed, which was triggering spurious failures. Patch from
Marty Alchin.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8842 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-09-02 03:07:26 +00:00
parent 63c9b7bf06
commit c435975cc7
1 changed files with 9 additions and 9 deletions

View File

@ -1030,7 +1030,7 @@ True
<class 'django.core.files.uploadedfile.SimpleUploadedFile'> <class 'django.core.files.uploadedfile.SimpleUploadedFile'>
>>> instance = f.save() >>> instance = f.save()
>>> instance.image >>> instance.image
<ImageFieldFile: tests/test.png> <...FieldFile: tests/test.png>
# Delete the current file since this is not done by Django. # Delete the current file since this is not done by Django.
>>> instance.image.delete() >>> instance.image.delete()
@ -1042,7 +1042,7 @@ True
<class 'django.core.files.uploadedfile.SimpleUploadedFile'> <class 'django.core.files.uploadedfile.SimpleUploadedFile'>
>>> instance = f.save() >>> instance = f.save()
>>> instance.image >>> instance.image
<ImageFieldFile: tests/test.png> <...FieldFile: tests/test.png>
# Edit an instance that already has the image defined in the model. This will not # Edit an instance that already has the image defined in the model. This will not
# save the image again, but leave it exactly as it is. # save the image again, but leave it exactly as it is.
@ -1051,10 +1051,10 @@ True
>>> f.is_valid() >>> f.is_valid()
True True
>>> f.cleaned_data['image'] >>> f.cleaned_data['image']
<ImageFieldFile: tests/test.png> <...FieldFile: tests/test.png>
>>> instance = f.save() >>> instance = f.save()
>>> instance.image >>> instance.image
<ImageFieldFile: tests/test.png> <...FieldFile: tests/test.png>
# Delete the current image since this is not done by Django. # Delete the current image since this is not done by Django.
@ -1067,7 +1067,7 @@ True
True True
>>> instance = f.save() >>> instance = f.save()
>>> instance.image >>> instance.image
<ImageFieldFile: tests/test2.png> <...FieldFile: tests/test2.png>
# Delete the current file since this is not done by Django. # Delete the current file since this is not done by Django.
>>> instance.image.delete() >>> instance.image.delete()
@ -1078,7 +1078,7 @@ True
True True
>>> instance = f.save() >>> instance = f.save()
>>> instance.image >>> instance.image
<ImageFieldFile: tests/test2.png> <...FieldFile: tests/test2.png>
# Delete the current file since this is not done by Django. # Delete the current file since this is not done by Django.
>>> instance.image.delete() >>> instance.image.delete()
@ -1092,14 +1092,14 @@ True
True True
>>> instance = f.save() >>> instance = f.save()
>>> instance.image >>> instance.image
<ImageFieldFile: None> <...FieldFile: None>
>>> f = ImageFileForm(data={'description': u'And a final one'}, files={'image': SimpleUploadedFile('test3.png', image_data)}, instance=instance) >>> f = ImageFileForm(data={'description': u'And a final one'}, files={'image': SimpleUploadedFile('test3.png', image_data)}, instance=instance)
>>> f.is_valid() >>> f.is_valid()
True True
>>> instance = f.save() >>> instance = f.save()
>>> instance.image >>> instance.image
<ImageFieldFile: tests/test3.png> <...FieldFile: tests/test3.png>
# Delete the current file since this is not done by Django. # Delete the current file since this is not done by Django.
>>> instance.image.delete() >>> instance.image.delete()
@ -1110,7 +1110,7 @@ True
True True
>>> instance = f.save() >>> instance = f.save()
>>> instance.image >>> instance.image
<ImageFieldFile: tests/test3.png> <...FieldFile: tests/test3.png>
>>> instance.delete() >>> instance.delete()
# Media on a ModelForm ######################################################## # Media on a ModelForm ########################################################