Source code for sqlobject.tests.test_create_drop
from sqlobject import BLOBCol, DateTimeCol, IntCol, SQLObject, StringCol, \
    sqlmeta
from sqlobject.tests.dbtest import getConnection
[docs]class SOTestCreateDrop(SQLObject):
    name = StringCol()
    number = IntCol()
    so_time = DateTimeCol()
    short = StringCol(length=10)
    blobcol = BLOBCol() 
[docs]def test_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)