@@ -35,13 +35,13 @@ def tearDown(self):
3535
3636 del self .cursor
3737 orphans = gc .collect ()
38- self .failIf (
38+ self .assertFalse (
3939 orphans , "%d orphaned objects found after deleting cursor" % orphans
4040 )
4141
4242 del self .connection
4343 orphans = gc .collect ()
44- self .failIf (
44+ self .assertFalse (
4545 orphans , "%d orphaned objects found after deleting connection" % orphans
4646 )
4747
@@ -82,7 +82,7 @@ def create_table(self, columndefs):
8282 def check_data_integrity (self , columndefs , generator ):
8383 # insert
8484 self .create_table (columndefs )
85- insert_statement = "INSERT INTO %s VALUES (%s)" % (
85+ insert_statement = "INSERT INTO {} VALUES ({})" . format (
8686 self .table ,
8787 "," .join (["%s" ] * len (columndefs )),
8888 )
@@ -113,7 +113,7 @@ def generator(row, col):
113113 return ("%i" % (row % 10 )) * 255
114114
115115 self .create_table (columndefs )
116- insert_statement = "INSERT INTO %s VALUES (%s)" % (
116+ insert_statement = "INSERT INTO {} VALUES ({})" . format (
117117 self .table ,
118118 "," .join (["%s" ] * len (columndefs )),
119119 )
@@ -131,11 +131,11 @@ def generator(row, col):
131131 self .assertEqual (res [i ][j ], generator (i , j ))
132132 delete_statement = "delete from %s where col1=%%s" % self .table
133133 self .cursor .execute (delete_statement , (0 ,))
134- self .cursor .execute ("select col1 from %s where col1=%s" % ( self . table , 0 ))
134+ self .cursor .execute (f "select col1 from { self . table } where col1=%s", ( 0 , ))
135135 res = self .cursor .fetchall ()
136136 self .assertFalse (res , "DELETE didn't work" )
137137 self .connection .rollback ()
138- self .cursor .execute ("select col1 from %s where col1=%s" % ( self . table , 0 ))
138+ self .cursor .execute (f "select col1 from { self . table } where col1=%s", ( 0 , ))
139139 res = self .cursor .fetchall ()
140140 self .assertTrue (len (res ) == 1 , "ROLLBACK didn't work" )
141141 self .cursor .execute ("drop table %s" % (self .table ))
@@ -150,7 +150,7 @@ def generator(row, col):
150150 return ("%i" % (row % 10 )) * ((255 - self .rows // 2 ) + row )
151151
152152 self .create_table (columndefs )
153- insert_statement = "INSERT INTO %s VALUES (%s)" % (
153+ insert_statement = "INSERT INTO {} VALUES ({})" . format (
154154 self .table ,
155155 "," .join (["%s" ] * len (columndefs )),
156156 )
0 commit comments