Source code for sqlobject.tests.test_create_drop

fromsqlobjectimport BLOBCol, DateTimeCol, IntCol, SQLObject, StringCol, \
 sqlmeta
fromsqlobject.tests.dbtestimport getConnection
[docs] classSOTestCreateDrop(SQLObject):
[docs] classsqlmeta(sqlmeta): idName = 'test_id_here' table = 'test_create_drop_table'
name = StringCol() number = IntCol() so_time = DateTimeCol() short = StringCol(length=10) blobcol = BLOBCol()
[docs] deftest_create_drop(): conn = getConnection() SOTestCreateDrop.setConnection(conn) SOTestCreateDrop.dropTable(ifExists=True) assert not conn.tableExists(SOTestCreateDrop.sqlmeta.table) SOTestCreateDrop.createTable(ifNotExists=True) assert conn.tableExists(SOTestCreateDrop.sqlmeta.table) SOTestCreateDrop.createTable(ifNotExists=True) assert conn.tableExists(SOTestCreateDrop.sqlmeta.table) SOTestCreateDrop.dropTable(ifExists=True) assert not conn.tableExists(SOTestCreateDrop.sqlmeta.table) SOTestCreateDrop.dropTable(ifExists=True) assert not conn.tableExists(SOTestCreateDrop.sqlmeta.table)