Exemple #1
0
def default_select() -> que.Select:
    field = que.Field("foo", "bar")
    fylter = que.Filter(field)
    select = que.Select(table="foo",
                        schema="bar",
                        fields=[field],
                        filters=[fylter])
    return select
Exemple #2
0
def default_update() -> que.Update:
    field = que.Field("foo", "bar")
    fylter = que.Filter(field)
    update = que.Update(table="foo",
                        schema="bar",
                        fields=[field],
                        filters=[fylter])
    return update
Exemple #3
0
def test_filter_invalid():
    with pytest.raises(TypeError):
        que.Filter(que.Field("foo"))
Exemple #4
0
def test_field_invalid():
    with pytest.raises(TypeError):
        que.Field()
Exemple #5
0
def default_delete() -> que.Delete:
    field = que.Field("foo", "bar")
    fylter = que.Filter(field)
    delete = que.Delete(table="foo", schema="bar", filters=[fylter])
    return delete
Exemple #6
0
def default_field_list() -> que.FieldList:
    return que.FieldList([que.Field("foo", "bar")])
Exemple #7
0
def test_append_filterlist():
    fylter = que.Filter(que.Field("foo", "bar"))
    lyst = que.FilterList()
    lyst.append(fylter)
    assert fylter in lyst
Exemple #8
0
def test_write_invalid():
    with pytest.raises(TypeError):
        que.Insert("foo", fields=[que.Field(value="foo")])
Exemple #9
0
def default_insert() -> que.Insert:
    field = que.Field("foo", "bar")
    insert = que.Insert(table="foo", schema="bar", fields=[field])
    return insert
Exemple #10
0
def test_insert_get_returning(default_insert):
    default_insert.returns = que.Field("id")
    sql, args = default_insert.to_sql()
    assert sql.endswith("RETURNING id")
Exemple #11
0
def test_update_get_returning(default_update):
    default_update.returns = que.Field("id")
    sql, args = default_update.to_sql()
    assert sql.endswith("RETURNING id")