2020 if os .getenv ("REQUIRE_ASPELL" , "false" ).lower () == "true" :
2121 raise RuntimeError (
2222 "Cannot run complete tests without aspell when "
23- "REQUIRE_ASPELL=true. Got error during import:\n {}" . format ( exp )
23+ f "REQUIRE_ASPELL=true. Got error during import:\n { exp } "
2424 )
2525 warnings .warn (
2626 "aspell not found, but not required, skipping aspell tests. Got "
27- "error during import:\n {}" . format ( exp ) ,
27+ f "error during import:\n { exp } " ,
2828 stacklevel = 2 ,
2929 )
3030
@@ -277,10 +277,9 @@ def test_dictionary_looping(
277277 for line in fid :
278278 err , rep = line .split ("->" )
279279 err = err .lower ()
280- assert err not in this_err_dict , "error {!r} already exists in {}" .format (
281- err ,
282- short_fname ,
283- )
280+ assert (
281+ err not in this_err_dict
282+ ), f"error { err :!r} already exists in { short_fname } "
284283 rep = rep .rstrip ("\n " )
285284 reps = [r .strip () for r in rep .lower ().split ("," )]
286285 reps = [r for r in reps if len (r )]
@@ -289,38 +288,31 @@ def test_dictionary_looping(
289288 for err in this_err_dict :
290289 for r in this_err_dict [err ]:
291290 assert r not in this_err_dict , (
292- "error {}: correction {} is an error itself in the same "
293- " dictionary file {}" . format ( err , r , short_fname )
291+ f "error { err } : correction { r } is an error itself "
292+ f"in the same dictionary file { short_fname } "
294293 )
295294 pair = (short_fname , short_fname )
296295 assert pair not in global_pairs
297296 global_pairs .add (pair )
298297 for other_fname , other_err_dict in global_err_dicts .items ():
299298 # error duplication (eventually maybe we should just merge?)
300299 for err in this_err_dict :
301- assert (
302- err not in other_err_dict
303- ), "error {!r} in dictionary {} already exists in dictionary {}" .format (
304- err ,
305- short_fname ,
306- other_fname ,
300+ assert err not in other_err_dict , (
301+ f"error { err :!r} in dictionary { short_fname } "
302+ f"already exists in dictionary { other_fname } "
307303 )
308304 # 2. check corrections in this dict against other dicts (upper)
309305 pair = (short_fname , other_fname )
310306 if pair not in allowed_dups :
311307 for err in this_err_dict :
312- assert (
313- err not in other_err_dict
314- ), "error {!r} in dictionary {} already exists in dictionary {}" .format (
315- err ,
316- short_fname ,
317- other_fname ,
308+ assert err not in other_err_dict , (
309+ f"error { err :!r} in dictionary { short_fname } "
310+ f"already exists in dictionary { other_fname } "
318311 )
319312 for r in this_err_dict [err ]:
320313 assert r not in other_err_dict , (
321- "error %s: correction %s from dictionary %s is an "
322- "error itself in dictionary %s"
323- % (err , r , short_fname , other_fname )
314+ f"error { err } : correction { r } from dictionary { short_fname } "
315+ f"is an error itself in dictionary { other_fname } "
324316 )
325317 assert pair not in global_pairs
326318 global_pairs .add (pair )
@@ -330,9 +322,8 @@ def test_dictionary_looping(
330322 for err in other_err_dict :
331323 for r in other_err_dict [err ]:
332324 assert r not in this_err_dict , (
333- "error %s: correction %s from dictionary %s is an "
334- "error itself in dictionary %s"
335- % (err , r , other_fname , short_fname )
325+ f"error { err } : correction { r } from dictionary { other_fname } "
326+ f"is an error itself in dictionary { short_fname } "
336327 )
337328 assert pair not in global_pairs
338329 global_pairs .add (pair )
0 commit comments