@@ -417,7 +417,7 @@ def test_transfer_transfers_all_tables_from_mysql_to_sqlite(
417
417
assert not any (record .levelname == "ERROR" for record in caplog .records )
418
418
419
419
sqlite_engine : Engine = create_engine (
420
- "sqlite:///{database}" . format ( database = sqlite_database ) ,
420
+ f "sqlite:///{ sqlite_database } " ,
421
421
json_serializer = json .dumps ,
422
422
json_deserializer = json .loads ,
423
423
)
@@ -426,13 +426,7 @@ def test_transfer_transfers_all_tables_from_mysql_to_sqlite(
426
426
sqlite_inspect : Inspector = inspect (sqlite_engine )
427
427
sqlite_tables : t .List [str ] = sqlite_inspect .get_table_names ()
428
428
mysql_engine : Engine = create_engine (
429
- "mysql+mysqldb://{user}:{password}@{host}:{port}/{database}" .format (
430
- user = mysql_credentials .user ,
431
- password = mysql_credentials .password ,
432
- host = mysql_credentials .host ,
433
- port = mysql_credentials .port ,
434
- database = mysql_credentials .database ,
435
- )
429
+ f"mysql+mysqldb://{ mysql_credentials .user } :{ mysql_credentials .password } @{ mysql_credentials .host } :{ mysql_credentials .port } /{ mysql_credentials .database } "
436
430
)
437
431
mysql_cnx : Connection = mysql_engine .connect ()
438
432
mysql_inspect : Inspector = inspect (mysql_engine )
@@ -466,10 +460,7 @@ def test_transfer_transfers_all_tables_from_mysql_to_sqlite(
466
460
mysql_index : t .Dict [str , t .Any ] = {}
467
461
for key in index_keys :
468
462
if key == "name" and prefix_indices :
469
- mysql_index [key ] = "{table}_{name}" .format (
470
- table = table_name ,
471
- name = index [key ], # type: ignore[literal-required]
472
- )
463
+ mysql_index [key ] = f"{ table_name } _{ index [key ]} " # type: ignore[literal-required]
473
464
else :
474
465
mysql_index [key ] = index [key ] # type: ignore[literal-required]
475
466
mysql_indices .append (t .cast (ReflectedIndex , mysql_index ))
@@ -510,7 +501,7 @@ def test_transfer_transfers_all_tables_from_mysql_to_sqlite(
510
501
mysql_fk_result : CursorResult = mysql_cnx .execute (mysql_fk_stmt )
511
502
mysql_foreign_keys : t .List [t .Dict [str , t .Any ]] = [dict (row ) for row in mysql_fk_result .mappings ()]
512
503
513
- sqlite_fk_stmt : TextClause = text ('PRAGMA foreign_key_list("{table }")' . format ( table = table_name ) )
504
+ sqlite_fk_stmt : TextClause = text (f 'PRAGMA foreign_key_list("{ table_name } ")' )
514
505
sqlite_fk_result : CursorResult = sqlite_cnx .execute (sqlite_fk_stmt )
515
506
if sqlite_fk_result .returns_rows :
516
507
for row in sqlite_fk_result .mappings ():
@@ -884,13 +875,7 @@ def test_transfer_specific_tables_transfers_only_specified_tables_from_mysql_to_
884
875
exclude_tables : bool ,
885
876
) -> None :
886
877
mysql_engine : Engine = create_engine (
887
- "mysql+mysqldb://{user}:{password}@{host}:{port}/{database}" .format (
888
- user = mysql_credentials .user ,
889
- password = mysql_credentials .password ,
890
- host = mysql_credentials .host ,
891
- port = mysql_credentials .port ,
892
- database = mysql_credentials .database ,
893
- )
878
+ f"mysql+mysqldb://{ mysql_credentials .user } :{ mysql_credentials .password } @{ mysql_credentials .host } :{ mysql_credentials .port } /{ mysql_credentials .database } "
894
879
)
895
880
mysql_cnx : Connection = mysql_engine .connect ()
896
881
mysql_inspect : Inspector = inspect (mysql_engine )
@@ -921,7 +906,7 @@ def test_transfer_specific_tables_transfers_only_specified_tables_from_mysql_to_
921
906
message in [record .message for record in caplog .records ]
922
907
for message in set (
923
908
[
924
- "Transferring table {}" . format ( table )
909
+ f "Transferring table { table } "
925
910
for table in (remaining_tables if exclude_tables else random_mysql_tables )
926
911
]
927
912
+ ["Done!" ]
@@ -931,7 +916,7 @@ def test_transfer_specific_tables_transfers_only_specified_tables_from_mysql_to_
931
916
assert not any (record .levelname == "ERROR" for record in caplog .records )
932
917
933
918
sqlite_engine : Engine = create_engine (
934
- "sqlite:///{database}" . format ( database = sqlite_database ) ,
919
+ f "sqlite:///{ sqlite_database } " ,
935
920
json_serializer = json .dumps ,
936
921
json_deserializer = json .loads ,
937
922
)
@@ -960,10 +945,7 @@ def test_transfer_specific_tables_transfers_only_specified_tables_from_mysql_to_
960
945
mysql_index : t .Dict [str , t .Any ] = {}
961
946
for key in index_keys :
962
947
if key == "name" and prefix_indices :
963
- mysql_index [key ] = "{table}_{name}" .format (
964
- table = table_name ,
965
- name = index [key ], # type: ignore[literal-required]
966
- )
948
+ mysql_index [key ] = f"{ table_name } _{ index [key ]} " # type: ignore[literal-required]
967
949
else :
968
950
mysql_index [key ] = index [key ] # type: ignore[literal-required]
969
951
mysql_indices .append (t .cast (ReflectedIndex , mysql_index ))
@@ -1185,7 +1167,7 @@ def test_transfer_limited_rows_from_mysql_to_sqlite(
1185
1167
assert not any (record .levelname == "ERROR" for record in caplog .records )
1186
1168
1187
1169
sqlite_engine : Engine = create_engine (
1188
- "sqlite:///{database}" . format ( database = sqlite_database ) ,
1170
+ f "sqlite:///{ sqlite_database } " ,
1189
1171
json_serializer = json .dumps ,
1190
1172
json_deserializer = json .loads ,
1191
1173
)
@@ -1194,13 +1176,7 @@ def test_transfer_limited_rows_from_mysql_to_sqlite(
1194
1176
sqlite_inspect : Inspector = inspect (sqlite_engine )
1195
1177
sqlite_tables : t .List [str ] = sqlite_inspect .get_table_names ()
1196
1178
mysql_engine : Engine = create_engine (
1197
- "mysql+mysqldb://{user}:{password}@{host}:{port}/{database}" .format (
1198
- user = mysql_credentials .user ,
1199
- password = mysql_credentials .password ,
1200
- host = mysql_credentials .host ,
1201
- port = mysql_credentials .port ,
1202
- database = mysql_credentials .database ,
1203
- )
1179
+ f"mysql+mysqldb://{ mysql_credentials .user } :{ mysql_credentials .password } @{ mysql_credentials .host } :{ mysql_credentials .port } /{ mysql_credentials .database } "
1204
1180
)
1205
1181
mysql_cnx : Connection = mysql_engine .connect ()
1206
1182
mysql_inspect : Inspector = inspect (mysql_engine )
@@ -1234,10 +1210,7 @@ def test_transfer_limited_rows_from_mysql_to_sqlite(
1234
1210
mysql_index : t .Dict [str , t .Any ] = {}
1235
1211
for key in index_keys :
1236
1212
if key == "name" and prefix_indices :
1237
- mysql_index [key ] = "{table}_{name}" .format (
1238
- table = table_name ,
1239
- name = index [key ], # type: ignore[literal-required]
1240
- )
1213
+ mysql_index [key ] = f"{ table_name } _{ index [key ]} " # type: ignore[literal-required]
1241
1214
else :
1242
1215
mysql_index [key ] = index [key ] # type: ignore[literal-required]
1243
1216
mysql_indices .append (t .cast (ReflectedIndex , mysql_index ))
@@ -1278,7 +1251,7 @@ def test_transfer_limited_rows_from_mysql_to_sqlite(
1278
1251
mysql_fk_result : CursorResult = mysql_cnx .execute (mysql_fk_stmt )
1279
1252
mysql_foreign_keys : t .List [t .Dict [str , t .Any ]] = [dict (row ) for row in mysql_fk_result .mappings ()]
1280
1253
1281
- sqlite_fk_stmt : TextClause = text ('PRAGMA foreign_key_list("{table }")' . format ( table = table_name ) )
1254
+ sqlite_fk_stmt : TextClause = text (f 'PRAGMA foreign_key_list("{ table_name } ")' )
1282
1255
sqlite_fk_result : CursorResult = sqlite_cnx .execute (sqlite_fk_stmt )
1283
1256
if sqlite_fk_result .returns_rows :
1284
1257
for row in sqlite_fk_result .mappings ():
0 commit comments