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 77
88from PIL import Image , ImageMorph , _imagingmorph
99
10- from .helper import assert_image_equal_tofile , hopper
10+ from .helper import assert_image_equal_tofile , hopper , timeout_unless_slower_valgrind
1111
1212
1313def string_to_img (image_string : str ) -> Image .Image :
@@ -266,16 +266,18 @@ def test_unknown_pattern() -> None:
266266 ImageMorph .LutBuilder (op_name = "unknown" )
267267
268268
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 :
270274 # Arrange
271275 lb = ImageMorph .LutBuilder (op_name = "corner" )
272- new_patterns = ["a pattern with a syntax error" ]
276+ new_patterns = [pattern ]
273277 lb .add_patterns (new_patterns )
274278
275279 # 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 "' ):
279281 lb .build_lut ()
280282
281283
Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ def build_lut(self) -> bytearray:
150150
151151 # Parse and create symmetries of the patterns strings
152152 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 " , "" ))
154154 if not m :
155155 msg = 'Syntax error in pattern "' + p + '"'
156156 raise Exception (msg )
You can’t perform that action at this time.
0 commit comments