Ejemplo n.º 1
0
    def test_complicated(self, less_than, greater_than):
        first = q.Q("a", q.Q("b", q.And(q.Q("c", less_than), greater_than)))

        second = q.Q("a", q.Q("b", q.Q("c", greater_than)))

        combined = q.Q(
            "a",
            q.Q("b",
                q.And(q.Q("c", q.And(less_than, greater_than)), greater_than)))

        assert first & second == combined
Ejemplo n.º 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
                )
            )
        )
    )
Ejemplo n.º 3
0
def test_single_argument():
    assert isinstance(q.And(q.Q("a")), q.Q)
Ejemplo n.º 4
0
def test_and_commutativity():
    a_and_b = q.And(q.Q("a"), q.Q("b"))
    combined = a_and_b & q.Q("c")

    assert combined == q.And(q.Q("a"), q.Q("b"), q.Q("c"))
    assert len(combined.conditions) == 3
Ejemplo n.º 5
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
Ejemplo n.º 6
0
def make_second_level(less_than, greater_than):
    return q.Q("a", q.And(less_than, q.Q('b', greater_than)))
Ejemplo n.º 7
0
def make_simple_and(less_than, greater_than):
    return q.Q("a", q.And(less_than, greater_than))