def test_memorydb(): if not supports("memorydb"): return connection = getConnection() if connection.dbName != "sqlite": return if not connection._memory: return setupClass(TestSO1) connection.close() # create a new connection to an in-memory database TestSO1.setConnection(connection) TestSO1.createTable()
def testSelect(): setupGetters(TestSO1) for obj in TestSO1.select('all'): obj.destroySelf() assert list(TestSO1.select('all')) == []
def testDeleteBy(): setupGetters(TestSO1) TestSO1.deleteBy(name="dave") assert len(list(TestSO1.select())) == 3
def testDeleteMany(): setupGetters(TestSO1) TestSO1.deleteMany(OR(TestSO1.q.name=="bob", TestSO1.q.name=="fred")) assert len(list(TestSO1.select('all'))) == 2
def do_select(): list(TestSO1.select())
def test_empty_string(): setupClass(TestSO1) test = TestSO1(name=None, passwd='') assert test.name is None assert test.passwd == ''
def testDeleteMany(): setupGetters(TestSO1) TestSO1.deleteMany(OR(TestSO1.q.name == "bob", TestSO1.q.name == "fred")) assert len(list(TestSO1.select('all'))) == 2