File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -291,7 +291,7 @@ def _check_aspect_ratios(self):
291291 return errors
292292
293293 def _check_width_height_field (self ):
294- if None in self . aspect_ratios and not (self .width_field and self .height_field ):
294+ if not (self .width_field and self .height_field ):
295295 return [
296296 checks .Warning (
297297 "width_field and height_field attributes are missing" ,
Original file line number Diff line number Diff line change @@ -825,9 +825,19 @@ def test_check_aspect_ratios(self):
825825 assert errors
826826 assert errors [0 ].id == "fields.E100"
827827
828- def test_check_width_height_field (self ):
829- assert not PictureField (aspect_ratios = ["3/2" ])._check_width_height_field ()
830- with override_field_aspect_ratios (Profile .picture .field , [None ]):
828+ @pytest .mark .parametrize (
829+ "aspect_ratios" ,
830+ [
831+ ("3/2" ,),
832+ (None ,),
833+ (
834+ "3/2" ,
835+ None ,
836+ ),
837+ ],
838+ )
839+ def test_check_width_height_field (self , aspect_ratios ):
840+ with override_field_aspect_ratios (Profile .picture .field , aspect_ratios ):
831841 errors = Profile .picture .field ._check_width_height_field ()
832842 assert errors
833843 assert errors [0 ].id == "fields.E101"
You can’t perform that action at this time.
0 commit comments