9
9
10
10
11
11
class SQLTests (unittest .TestCase ):
12
-
13
12
def test_multiple_statements (self ):
14
13
self .assertRaises (RuntimeError , self .db .execute , "INSERT INTO cs50(val) VALUES('baz'); INSERT INTO cs50(val) VALUES('qux')" )
15
14
@@ -146,7 +145,6 @@ def tearDownClass(self):
146
145
if not str (e ).startswith ("(1051" ):
147
146
raise e
148
147
149
-
150
148
class MySQLTests (SQLTests ):
151
149
@classmethod
152
150
def setUpClass (self ):
@@ -156,7 +154,6 @@ def setUp(self):
156
154
self .db .execute ("CREATE TABLE IF NOT EXISTS cs50 (id INTEGER NOT NULL AUTO_INCREMENT, val VARCHAR(16), bin BLOB, PRIMARY KEY (id))" )
157
155
self .db .execute ("DELETE FROM cs50" )
158
156
159
-
160
157
class PostgresTests (SQLTests ):
161
158
@classmethod
162
159
def setUpClass (self ):
@@ -174,7 +171,6 @@ def test_postgres_scheme(self):
174
171
db .execute ("SELECT 1" )
175
172
176
173
class SQLiteTests (SQLTests ):
177
-
178
174
@classmethod
179
175
def setUpClass (self ):
180
176
open ("test.db" , "w" ).close ()
@@ -286,7 +282,6 @@ def test_named(self):
286
282
self .assertRaises (RuntimeError , self .db .execute , "INSERT INTO foo VALUES (:bar, :baz)" , bar = 'bar' , baz = 'baz' , qux = 'qux' )
287
283
self .assertRaises (RuntimeError , self .db .execute , "INSERT INTO foo VALUES (:bar, :baz)" , 'baz' , bar = 'bar' )
288
284
289
-
290
285
def test_numeric (self ):
291
286
self .db .execute ("CREATE TABLE foo (firstname STRING, lastname STRING)" )
292
287
@@ -322,7 +317,6 @@ def test_numeric(self):
322
317
def test_cte (self ):
323
318
self .assertEqual (self .db .execute ("WITH foo AS ( SELECT 1 AS bar ) SELECT bar FROM foo" ), [{"bar" : 1 }])
324
319
325
-
326
320
if __name__ == "__main__" :
327
321
suite = unittest .TestSuite ([
328
322
unittest .TestLoader ().loadTestsFromTestCase (SQLiteTests ),
0 commit comments