@@ -352,7 +352,7 @@ def helpTestDataType(
352
352
ok = False
353
353
self .assertTrue (
354
354
rs [0 ] in allowedReturnValues ,
355
- 'Value "%s " not in %s' % ( repr ( rs [ 0 ]), allowedReturnValues ) ,
355
+ f 'Value "{ rs [ 0 ]!r } " not in { allowedReturnValues } ' ,
356
356
)
357
357
else :
358
358
self .assertEqual (
@@ -697,17 +697,15 @@ def testRowIterator(self):
697
697
rec [j ] == inParam [j ]
698
698
), 'returned value:"%s" != test value:"%s"' % (rec [j ], inParam [j ])
699
699
# check that we can get a complete tuple from a row
700
- assert tuple (rec ) == inParam , 'returned value:"%s" != test value:"%s"' % (
701
- repr (rec ),
702
- repr (inParam ),
703
- )
700
+ assert (
701
+ tuple (rec ) == inParam
702
+ ), f'returned value:"{ rec !r} " != test value:"{ inParam !r} "'
704
703
# test that slices of rows work
705
704
slice1 = tuple (rec [:- 1 ])
706
705
slice2 = tuple (inParam [0 :2 ])
707
- assert slice1 == slice2 , 'returned value:"%s" != test value:"%s"' % (
708
- repr (slice1 ),
709
- repr (slice2 ),
710
- )
706
+ assert (
707
+ slice1 == slice2
708
+ ), f'returned value:"{ slice1 !r} " != test value:"{ slice2 !r} "'
711
709
# now test named column retrieval
712
710
assert rec ["fldTwo" ] == inParam [0 ]
713
711
assert rec .fldThree == inParam [1 ]
@@ -1027,10 +1025,9 @@ def testAutoRollback(self):
1027
1025
row = crsr .fetchone ()
1028
1026
except api .DatabaseError :
1029
1027
row = None # if the entire table disappeared the rollback was perfect and the test passed
1030
- assert row is None , (
1031
- "cursor.fetchone should return None if a query retrieves no rows. Got %s"
1032
- % repr (row )
1033
- )
1028
+ assert (
1029
+ row is None
1030
+ ), f"cursor.fetchone should return None if a query retrieves no rows. Got { row !r} "
1034
1031
self .helpRollbackTblTemp ()
1035
1032
1036
1033
def testAutoCommit (self ):
@@ -1164,11 +1161,11 @@ def testVariableReturningStoredProcedure(self):
1164
1161
retvalues = crsr .callproc (
1165
1162
"sp_DeleteMeOnlyForTesting" , ("Dodsworth" , "Anne" , " " )
1166
1163
)
1167
- assert retvalues [0 ] == "Dodsworth" , '%s is not "Dodsworth"' % repr ( retvalues [ 0 ])
1168
- assert retvalues [1 ] == "Anne" , '%s is not "Anne"' % repr ( retvalues [ 1 ])
1169
- assert retvalues [ 2 ] == "DodsworthAnne" , '%s is not "DodsworthAnne"' % repr (
1170
- retvalues [2 ]
1171
- )
1164
+ assert retvalues [0 ] == "Dodsworth" , f' { retvalues [ 0 ]!r } is not "Dodsworth"'
1165
+ assert retvalues [1 ] == "Anne" , f' { retvalues [ 1 ]!r } is not "Anne"'
1166
+ assert (
1167
+ retvalues [2 ] == "DodsworthAnne"
1168
+ ), f' { retvalues [ 2 ]!r } is not "DodsworthAnne"'
1172
1169
self .conn .rollback ()
1173
1170
1174
1171
def testMultipleSetReturn (self ):
@@ -1344,19 +1341,16 @@ def testOkConnect(self):
1344
1341
# /* (SELECT 'a small string' as result; */
1345
1342
# END $$
1346
1343
# """
1347
- #
1348
1344
# crsr.execute(spdef)
1349
- #
1350
1345
# retvalues = crsr.callproc(
1351
1346
# "DeleteMeOnlyForTesting", ("Dodsworth", "Anne", " ")
1352
1347
# )
1353
- # print("return value (mysql)=", repr(crsr.returnValue))
1354
- # assert retvalues[0] == "Dodsworth", '%s is not "Dodsworth"' % repr(retvalues[0])
1355
- # assert retvalues[1] == "Anne", '%s is not "Anne"' % repr(retvalues[1])
1356
- # assert retvalues[2] == "DodsworthAnne", '%s is not "DodsworthAnne"' % repr(
1357
- # retvalues[2]
1358
- # )
1359
- #
1348
+ # # print(f"return value (mysql)={crsr.returnValue!r}")
1349
+ # assert retvalues[0] == "Dodsworth", f'{retvalues[0]!r} is not "Dodsworth"'
1350
+ # assert retvalues[1] == "Anne", f'{retvalues[1]!r} is not "Anne"'
1351
+ # assert (
1352
+ # retvalues[2] == "DodsworthAnne"
1353
+ # ), f'{retvalues[2]!r} is not "DodsworthAnne"'
1360
1354
# try:
1361
1355
# crsr.execute("DROP PROCEDURE, DeleteMeOnlyForTesting")
1362
1356
# self.conn.commit()
@@ -1413,12 +1407,12 @@ def testOkConnect(self):
1413
1407
# retvalues = crsr.callproc(
1414
1408
# "DeleteMeOnlyForTesting", ("Dodsworth", "Anne", " ")
1415
1409
# )
1416
- # # print("return value (pg)=", repr( crsr.returnValue) )
1417
- # assert retvalues[0] == "Dodsworth", '%s is not "Dodsworth"' % repr(retvalues[0])
1418
- # assert retvalues[1] == "Anne", '%s is not "Anne"' % repr(retvalues[1])
1419
- # assert retvalues[2] == "Dodsworth Anne", '%s is not "Dodsworth Anne"' % repr (
1420
- # retvalues[2]
1421
- # )
1410
+ # # print(f "return value (pg)={ crsr.returnValue!r}" )
1411
+ # assert retvalues[0] == "Dodsworth", f'{retvalues[0]!r} is not "Dodsworth"'
1412
+ # assert retvalues[1] == "Anne", f'{retvalues[1]!r} is not "Anne"'
1413
+ # assert (
1414
+ # retvalues[2] == "DodsworthAnne"
1415
+ # ), f'{retvalues[2]!r} is not "DodsworthAnne"'
1422
1416
# self.conn.rollback()
1423
1417
# try:
1424
1418
# crsr.execute("DROP PROCEDURE, DeleteMeOnlyForTesting")
@@ -1490,7 +1484,7 @@ def testDateObjectFromCOMDate(self):
1490
1484
t2 = time .gmtime (
1491
1485
time .mktime ((2002 , 6 , 29 , 12 , 14 , 2 , 4 , 31 + 28 + 31 + 30 + 31 + 28 , - 1 ))
1492
1486
)
1493
- assert t1 < cmd < t2 , '"%s " should be about 2002-6-28 12:15:01' % repr ( cmd )
1487
+ assert t1 < cmd < t2 , f'" { cmd } " should be about 2002-6-28 12:15:01'
1494
1488
1495
1489
def testDate (self ):
1496
1490
t1 = time .mktime ((2002 , 6 , 28 , 18 , 15 , 1 , 4 , 31 + 28 + 31 + 30 + 31 + 30 , 0 ))
0 commit comments