@@ -35,13 +35,13 @@ def tearDown(self):
35
35
36
36
del self .cursor
37
37
orphans = gc .collect ()
38
- self .failIf (
38
+ self .assertFalse (
39
39
orphans , "%d orphaned objects found after deleting cursor" % orphans
40
40
)
41
41
42
42
del self .connection
43
43
orphans = gc .collect ()
44
- self .failIf (
44
+ self .assertFalse (
45
45
orphans , "%d orphaned objects found after deleting connection" % orphans
46
46
)
47
47
@@ -82,7 +82,7 @@ def create_table(self, columndefs):
82
82
def check_data_integrity (self , columndefs , generator ):
83
83
# insert
84
84
self .create_table (columndefs )
85
- insert_statement = "INSERT INTO %s VALUES (%s)" % (
85
+ insert_statement = "INSERT INTO {} VALUES ({})" . format (
86
86
self .table ,
87
87
"," .join (["%s" ] * len (columndefs )),
88
88
)
@@ -113,7 +113,7 @@ def generator(row, col):
113
113
return ("%i" % (row % 10 )) * 255
114
114
115
115
self .create_table (columndefs )
116
- insert_statement = "INSERT INTO %s VALUES (%s)" % (
116
+ insert_statement = "INSERT INTO {} VALUES ({})" . format (
117
117
self .table ,
118
118
"," .join (["%s" ] * len (columndefs )),
119
119
)
@@ -131,11 +131,11 @@ def generator(row, col):
131
131
self .assertEqual (res [i ][j ], generator (i , j ))
132
132
delete_statement = "delete from %s where col1=%%s" % self .table
133
133
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 , ))
135
135
res = self .cursor .fetchall ()
136
136
self .assertFalse (res , "DELETE didn't work" )
137
137
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 , ))
139
139
res = self .cursor .fetchall ()
140
140
self .assertTrue (len (res ) == 1 , "ROLLBACK didn't work" )
141
141
self .cursor .execute ("drop table %s" % (self .table ))
@@ -150,7 +150,7 @@ def generator(row, col):
150
150
return ("%i" % (row % 10 )) * ((255 - self .rows // 2 ) + row )
151
151
152
152
self .create_table (columndefs )
153
- insert_statement = "INSERT INTO %s VALUES (%s)" % (
153
+ insert_statement = "INSERT INTO {} VALUES ({})" . format (
154
154
self .table ,
155
155
"," .join (["%s" ] * len (columndefs )),
156
156
)
0 commit comments