@@ -147,7 +147,7 @@ def test_patch_dataset_crash(tmp_path: Path) -> None:
147147 ],
148148 dtype = object ,
149149 )
150- with pytest .raises (ValueError , match = "Provided input array is non-numerical." ):
150+ with pytest .raises (ValueError , match = r "Provided input array is non-numerical." ):
151151 _ = PatchDataset (imgs )
152152
153153 # ndarray(s) of NHW images
@@ -160,7 +160,7 @@ def test_patch_dataset_crash(tmp_path: Path) -> None:
160160 RNG .integers (0 , 255 , (4 , 4 , 3 )),
161161 RNG .integers (0 , 255 , (4 , 5 , 3 )),
162162 ]
163- with pytest .raises (ValueError , match = "Images must have the same dimensions." ):
163+ with pytest .raises (ValueError , match = r "Images must have the same dimensions." ):
164164 _ = PatchDataset (imgs )
165165
166166 # list of ndarray(s) with HW and HWC mixed up
@@ -170,15 +170,15 @@ def test_patch_dataset_crash(tmp_path: Path) -> None:
170170 ]
171171 with pytest .raises (
172172 ValueError ,
173- match = "Each sample must be an array of the form HWC." ,
173+ match = r "Each sample must be an array of the form HWC." ,
174174 ):
175175 _ = PatchDataset (imgs )
176176
177177 # list of mixed dtype
178178 imgs = [RNG .integers (0 , 255 , (4 , 4 , 3 )), "you_should_crash_here" , 123 , 456 ]
179179 with pytest .raises (
180180 ValueError ,
181- match = "Input must be either a list/array of images or a list of "
181+ match = r "Input must be either a list/array of images or a list of "
182182 "valid image paths." ,
183183 ):
184184 _ = PatchDataset (imgs )
@@ -187,7 +187,7 @@ def test_patch_dataset_crash(tmp_path: Path) -> None:
187187 imgs = ["you_should_crash_here" , 123 , 456 ]
188188 with pytest .raises (
189189 ValueError ,
190- match = "Input must be either a list/array of images or a list of "
190+ match = r "Input must be either a list/array of images or a list of "
191191 "valid image paths." ,
192192 ):
193193 _ = PatchDataset (imgs )
@@ -290,11 +290,11 @@ def __getitem__(self: Proto, idx: int) -> object:
290290 )
291291
292292 # invalid mode
293- with pytest .raises (ValueError , match = "`X` is not supported." ):
293+ with pytest .raises (ValueError , match = r "`X` is not supported." ):
294294 reuse_init (mode = "X" )
295295
296296 # invalid patch
297- with pytest .raises (ValueError , match = "Invalid `patch_input_shape` value None." ):
297+ with pytest .raises (ValueError , match = r "Invalid `patch_input_shape` value None." ):
298298 reuse_init ()
299299 with pytest .raises (
300300 ValueError ,
@@ -306,7 +306,7 @@ def __getitem__(self: Proto, idx: int) -> object:
306306 match = r"Invalid `patch_input_shape` value \['512' 'a'\]." ,
307307 ):
308308 reuse_init_wsi (patch_input_shape = [512 , "a" ])
309- with pytest .raises (ValueError , match = "Invalid `stride_shape` value None." ):
309+ with pytest .raises (ValueError , match = r "Invalid `stride_shape` value None." ):
310310 reuse_init_wsi (patch_input_shape = 512 )
311311 # invalid stride
312312 with pytest .raises (
0 commit comments