File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
tests/forms_tests/field_tests Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 1
1
import pickle
2
+ import unittest
2
3
3
4
from django .core .exceptions import ValidationError
4
5
from django .core .files .uploadedfile import SimpleUploadedFile
5
6
from django .core .validators import validate_image_file_extension
6
7
from django .forms import FileField , FileInput
7
8
from django .test import SimpleTestCase
8
9
10
+ try :
11
+ from PIL import Image # NOQA
12
+ except ImportError :
13
+ HAS_PILLOW = False
14
+ else :
15
+ HAS_PILLOW = True
16
+
9
17
10
18
class FileFieldTest (SimpleTestCase ):
11
19
def test_filefield_1 (self ):
@@ -151,6 +159,7 @@ def test_file_multiple_empty(self):
151
159
with self .assertRaisesMessage (ValidationError , msg ):
152
160
f .clean (files [::- 1 ])
153
161
162
+ @unittest .skipUnless (HAS_PILLOW , "Pillow not installed" )
154
163
def test_file_multiple_validation (self ):
155
164
f = MultipleFileField (validators = [validate_image_file_extension ])
156
165
You can’t perform that action at this time.
0 commit comments