示例#1
0
def test_or(query_one, query_two, query_three, query_four):
    dqs1 = DetaQueryStatement(conditions=[query_one, query_two])
    dqs2 = DetaQueryStatement(conditions=[query_three, query_four])

    dql = dqs1 | dqs2

    assert isinstance(dql, DetaQueryList)
    assert dqs1 in dql.conditions
    assert dqs2 in dql.conditions
示例#2
0
def test_and(query_one, query_two, query_three, query_four):
    dqs1 = DetaQueryStatement(conditions=[query_one, query_two])
    dqs2 = DetaQueryStatement(conditions=[query_three, query_four])

    dqs3 = dqs1 & dqs2

    assert isinstance(dqs3, DetaQueryStatement)
    assert query_one in dqs3.conditions
    assert query_two in dqs3.conditions
    assert query_three in dqs3.conditions
    assert query_four in dqs3.conditions
示例#3
0
def test_and_deta_query(query_one, query_two, query_three):
    dqs1 = DetaQueryStatement(conditions=[query_one, query_two])

    dqs2 = dqs1 & query_three

    assert isinstance(dqs2, DetaQueryStatement)
    assert query_one in dqs2.conditions
    assert query_two in dqs2.conditions
    assert query_three in dqs2.conditions
示例#4
0
def test_or_deta_query_statement(query_one, query_two, query_three, query_four):
    dql1 = DetaQueryList(conditions=[query_one, query_two])
    dqs = DetaQueryStatement(conditions=[query_three, query_four])

    dql2 = dql1 | dqs

    assert isinstance(dql2, DetaQueryList)
    assert query_one in dql2.conditions
    assert query_two in dql2.conditions
    assert dqs in dql2.conditions
示例#5
0
def test_as_query(query_one, query_two):
    dqs = DetaQueryStatement(conditions=[query_one, query_two])
    assert dqs.as_query() == {
        "condition1": "value1",
        "condition2": "value2",
    }
示例#6
0
def test_and_deta_query_list_raises(query_one, query_two, query_three,
                                    query_four):
    dqs1 = DetaQueryStatement(conditions=[query_one, query_two])
    dql1 = DetaQueryList(conditions=[query_three, query_four])
    with pytest.raises(InvalidDetaQuery):
        dqs1 & dql1