示例#1
0
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()
示例#2
0
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()
示例#3
0
def testSelect():
    setupGetters(TestSO1)
    for obj in TestSO1.select('all'):
        obj.destroySelf()
    assert list(TestSO1.select('all')) == []
示例#4
0
def testDeleteBy():
    setupGetters(TestSO1)
    TestSO1.deleteBy(name="dave")
    assert len(list(TestSO1.select())) == 3
示例#5
0
def testDeleteMany():
    setupGetters(TestSO1)
    TestSO1.deleteMany(OR(TestSO1.q.name=="bob", TestSO1.q.name=="fred"))
    assert len(list(TestSO1.select('all'))) == 2
示例#6
0
def do_select():
    list(TestSO1.select())
示例#7
0
def do_select():
    list(TestSO1.select())
示例#8
0
def test_empty_string():
    setupClass(TestSO1)
    test = TestSO1(name=None, passwd='')
    assert test.name is None
    assert test.passwd == ''
示例#9
0
def testSelect():
    setupGetters(TestSO1)
    for obj in TestSO1.select('all'):
        obj.destroySelf()
    assert list(TestSO1.select('all')) == []
示例#10
0
def testDeleteBy():
    setupGetters(TestSO1)
    TestSO1.deleteBy(name="dave")
    assert len(list(TestSO1.select())) == 3
示例#11
0
def testDeleteMany():
    setupGetters(TestSO1)
    TestSO1.deleteMany(OR(TestSO1.q.name == "bob", TestSO1.q.name == "fred"))
    assert len(list(TestSO1.select('all'))) == 2