File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 7
7
8
8
from PIL import Image , ImageMorph , _imagingmorph
9
9
10
- from .helper import assert_image_equal_tofile , hopper
10
+ from .helper import assert_image_equal_tofile , hopper , timeout_unless_slower_valgrind
11
11
12
12
13
13
def string_to_img (image_string : str ) -> Image .Image :
@@ -266,16 +266,18 @@ def test_unknown_pattern() -> None:
266
266
ImageMorph .LutBuilder (op_name = "unknown" )
267
267
268
268
269
- def test_pattern_syntax_error () -> None :
269
+ @pytest .mark .parametrize (
270
+ "pattern" , ("a pattern with a syntax error" , "4:(" + "X" * 30000 )
271
+ )
272
+ @timeout_unless_slower_valgrind (1 )
273
+ def test_pattern_syntax_error (pattern : str ) -> None :
270
274
# Arrange
271
275
lb = ImageMorph .LutBuilder (op_name = "corner" )
272
- new_patterns = ["a pattern with a syntax error" ]
276
+ new_patterns = [pattern ]
273
277
lb .add_patterns (new_patterns )
274
278
275
279
# Act / Assert
276
- with pytest .raises (
277
- Exception , match = 'Syntax error in pattern "a pattern with a syntax error"'
278
- ):
280
+ with pytest .raises (Exception , match = 'Syntax error in pattern "' ):
279
281
lb .build_lut ()
280
282
281
283
Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ def build_lut(self) -> bytearray:
150
150
151
151
# Parse and create symmetries of the patterns strings
152
152
for p in self .patterns :
153
- m = re .search (r"(\w* ):?\s*\((.+?)\)\s*->\s*(\d)" , p .replace ("\n " , "" ))
153
+ m = re .search (r"(\w):?\s*\((.+?)\)\s*->\s*(\d)" , p .replace ("\n " , "" ))
154
154
if not m :
155
155
msg = 'Syntax error in pattern "' + p + '"'
156
156
raise Exception (msg )
You can’t perform that action at this time.
0 commit comments