fromsqlobjectimport BLOBCol, DateTimeCol, IntCol, SQLObject, StringCol, \
sqlmeta
fromsqlobject.tests.dbtestimport getConnection
[docs]
classSOTestCreateDrop(SQLObject):
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)