@@ -3028,6 +3028,12 @@ def test_errors(self):
3028
3028
with pytest .raises (ValueError , match = "Padding must be an int or a 1, 2, or 4" ):
3029
3029
transforms .RandomCrop ([10 , 12 ], padding = [- 0.7 , 0 , 0.7 ])
3030
3030
3031
+ with pytest .raises (ValueError , match = "Padding must be an int or a 1, 2, or 4 element of tuple or list" ):
3032
+ transforms .RandomCrop ([10 , 12 ], padding = 0.5 )
3033
+
3034
+ with pytest .raises (ValueError , match = "Padding must be an int or a 1, 2, or 4" ):
3035
+ transforms .RandomCrop ([10 , 12 ], padding = [0.5 , 0.5 ])
3036
+
3031
3037
with pytest .raises (TypeError , match = "Got inappropriate fill arg" ):
3032
3038
transforms .RandomCrop ([10 , 12 ], padding = 1 , fill = "abc" )
3033
3039
@@ -3887,9 +3893,15 @@ def test_transform_errors(self):
3887
3893
with pytest .raises (TypeError , match = "Got inappropriate padding arg" ):
3888
3894
transforms .Pad ("abc" )
3889
3895
3890
- with pytest .raises (ValueError , match = "Padding must be an int or a 1, 2, or 4" ):
3896
+ with pytest .raises (ValueError , match = "Padding must be an int or a 1, 2, or 4 element of tuple or list " ):
3891
3897
transforms .Pad ([- 0.7 , 0 , 0.7 ])
3892
3898
3899
+ with pytest .raises (ValueError , match = "Padding must be an int or a 1, 2, or 4 element of tuple or list" ):
3900
+ transforms .Pad (0.5 )
3901
+
3902
+ with pytest .raises (ValueError , match = "Padding must be an int or a 1, 2, or 4 element of tuple or list" ):
3903
+ transforms .Pad (padding = [0.5 , 0.5 ])
3904
+
3893
3905
with pytest .raises (TypeError , match = "Got inappropriate fill arg" ):
3894
3906
transforms .Pad (12 , fill = "abc" )
3895
3907
0 commit comments