@@ -146,11 +146,15 @@ def test_read_non_existant(self, reader, module, error_class, fn_ext):
146
146
msg3 = "Expected object or value"
147
147
msg4 = "path_or_buf needs to be a string file path or file-like"
148
148
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
+ )
152
156
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 } )"
154
158
):
155
159
reader (path )
156
160
@@ -177,17 +181,21 @@ def test_read_expands_user_home_dir(
177
181
path = os .path .join ("~" , "does_not_exist." + fn_ext )
178
182
monkeypatch .setattr (icom , "_expand_user" , lambda x : os .path .join ("foo" , x ))
179
183
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"
181
185
msg2 = fr"\[Errno 2\] No such file or directory: '.+does_not_exist\.{ fn_ext } '"
182
186
msg3 = "Unexpected character found when decoding 'false'"
183
187
msg4 = "path_or_buf needs to be a string file path or file-like"
184
188
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
+ )
188
196
189
197
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 } )"
191
199
):
192
200
reader (path )
193
201
0 commit comments