@@ -146,11 +146,15 @@ def test_read_non_existant(self, reader, module, error_class, fn_ext):
146146 msg3 = "Expected object or value"
147147 msg4 = "path_or_buf needs to be a string file path or file-like"
148148 msg5 = (
149- r"\[Errno 2\] File .+does_not_exist\.{} does not exist:"
150- r" '.+does_not_exist\.{}'"
151- ).format (fn_ext , fn_ext )
149+ fr"\[Errno 2\] File .+does_not_exist\.{ fn_ext } does not exist:"
150+ fr" '.+does_not_exist\.{ fn_ext } '"
151+ )
152+ msg6 = fr"\[Errno 2\] 没有那个文件或目录: '.+does_not_exist\.{ fn_ext } '"
153+ msg7 = (
154+ fr"\[Errno 2\] File o directory non esistente: '.+does_not_exist\.{ fn_ext } '"
155+ )
152156 with pytest .raises (
153- error_class , match = r "({}|{}|{}|{}|{})" . format ( msg1 , msg2 , msg3 , msg4 , msg5 )
157+ error_class , match = fr "({ msg1 } |{ msg2 } |{ msg3 } |{ msg4 } |{ msg5 } | { msg6 } | { msg7 } )"
154158 ):
155159 reader (path )
156160
@@ -177,17 +181,21 @@ def test_read_expands_user_home_dir(
177181 path = os .path .join ("~" , "does_not_exist." + fn_ext )
178182 monkeypatch .setattr (icom , "_expand_user" , lambda x : os .path .join ("foo" , x ))
179183
180- msg1 = r "File (b')?.+does_not_exist\.{}'? does not exist". format ( fn_ext )
184+ msg1 = fr "File (b')?.+does_not_exist\.{ fn_ext } '? does not exist"
181185 msg2 = fr"\[Errno 2\] No such file or directory: '.+does_not_exist\.{ fn_ext } '"
182186 msg3 = "Unexpected character found when decoding 'false'"
183187 msg4 = "path_or_buf needs to be a string file path or file-like"
184188 msg5 = (
185- r"\[Errno 2\] File .+does_not_exist\.{} does not exist:"
186- r" '.+does_not_exist\.{}'"
187- ).format (fn_ext , fn_ext )
189+ fr"\[Errno 2\] File .+does_not_exist\.{ fn_ext } does not exist:"
190+ fr" '.+does_not_exist\.{ fn_ext } '"
191+ )
192+ msg6 = fr"\[Errno 2\] 没有那个文件或目录: '.+does_not_exist\.{ fn_ext } '"
193+ msg7 = (
194+ fr"\[Errno 2\] File o directory non esistente: '.+does_not_exist\.{ fn_ext } '"
195+ )
188196
189197 with pytest .raises (
190- error_class , match = r "({}|{}|{}|{}|{})" . format ( msg1 , msg2 , msg3 , msg4 , msg5 )
198+ error_class , match = fr "({ msg1 } |{ msg2 } |{ msg3 } |{ msg4 } |{ msg5 } | { msg6 } | { msg7 } )"
191199 ):
192200 reader (path )
193201
0 commit comments