Пример #1
0
def test_delete_returning():
    d = (DELETE('table3').WHERE(x=25).RETURNING('this', 'that'))

    assert d.query == '\n'.join([
        "DELETE FROM table3", " WHERE x = %(x_bind_0)s",
        "RETURNING this, that;"
    ])
    assert d.binds == {'x_bind_0': 25}
Пример #2
0
def test_delete_where():
    d = (DELETE('table2').WHERE('x > 5'))

    assert d.query == '\n'.join(["DELETE FROM table2", " WHERE x > 5;"])
    assert d.binds == {}
Пример #3
0
def test_delete_where_autobind():
    d = (DELETE('table3').WHERE(x=25))

    assert d.query == '\n'.join(
        ["DELETE FROM table3", " WHERE x = %(x_bind_0)s;"])
    assert d.binds == {'x_bind_0': 25}
Пример #4
0
def test_simple_delete():
    d = DELETE('table1')

    assert d.query == 'DELETE FROM table1;'
    assert d.binds == {}