Пример #1
0
    def test_with_value(self):
        query = q.Q("a", q.V("=", 1))

        assert query.query == ("SELECT parent_id "
                               "FROM object AS o "
                               "JOIN value AS v "
                               "ON o.id = v.id "
                               "WHERE (o.name = 'a' "
                               "AND v.value = 1)")
Пример #2
0
def test_and(aggregator):
    construction = ((aggregator.centre == mock.Gaussian) & (aggregator.centre.x == 0))
    assert construction == q.Q(
        "centre",
        q.And(
            q.T(mock.Gaussian),
            q.Q(
                "x",
                q.V(
                    "=", 0
                )
            )
        )
    )
Пример #3
0
def test_greater_than_equals(aggregator):
    assert (aggregator.centre >= 1) == q.Q("centre", q.V(">=", 1))
Пример #4
0
def test_less_than_equals(aggregator):
    assert (aggregator.centre <= 1) == q.Q("centre", q.V("<=", 1))
Пример #5
0
def test_less_than(aggregator):
    assert (aggregator.centre < 1) == q.Q("centre", q.V("<", 1))
Пример #6
0
def test_greater_than(aggregator):
    assert (aggregator.centre > 1) == q.Q("centre", q.V(">", 1))
Пример #7
0
def test_third_level(aggregator):
    assert (aggregator.lens.centre.x == 1) == q.Q("lens", q.Q("centre", q.Q("x", q.V("=", 1))))
Пример #8
0
def test_second_level(aggregator):
    assert (aggregator.lens.centre == 1) == q.Q("lens", q.Q("centre", q.V("=", 1)))
Пример #9
0
def test_with_value(aggregator):
    assert (aggregator.centre == 1) == q.Q("centre", q.V("=", 1))
Пример #10
0
def test_and(aggregator):
    construction = ((aggregator.model.centre == af.Gaussian) &
                    (aggregator.model.centre.x == 0))
    assert construction.query == q.Q(
        "centre", q.And(q.T(af.Gaussian), q.Q("x", q.V("=", 0)))).query
Пример #11
0
def test_less_than_equals(aggregator):
    assert (aggregator.model.centre <= 1).query == q.Q("centre", q.V("<=",
                                                                     1)).query
Пример #12
0
def test_less_than(aggregator):
    assert (aggregator.model.centre < 1).query == q.Q("centre", q.V("<",
                                                                    1)).query
Пример #13
0
def test_greater_than(aggregator):
    assert (aggregator.model.centre > 1).query == q.Q("centre", q.V(">",
                                                                    1)).query
Пример #14
0
def test_with_value(aggregator):
    assert (aggregator.model.centre == 1).query == q.Q("centre", q.V("=",
                                                                     1)).query
Пример #15
0
def make_less_than():
    return q.V("<", 1)
Пример #16
0
def make_greater_than():
    return q.V(">", 0)