Exemplo n.º 1
0
def test_math():
    result = compute(sin(t.amount), s)
    assert normalize(str(result)) == normalize("""
            SELECT sin(accounts.amount) as amount
            FROM accounts""")

    result = compute(floor(t.amount), s)
    assert normalize(str(result)) == normalize("""
            SELECT floor(accounts.amount) as amount
            FROM accounts""")

    result = compute(t.amount // 2, s)
    assert normalize(str(result)) == normalize("""
            SELECT floor(accounts.amount / :amount_1) AS amount
            FROM accounts""")
Exemplo n.º 2
0
def test_math():
    result = compute(sin(t.amount), s)
    assert normalize(str(result)) == normalize("""
            SELECT sin(accounts.amount) as amount
            FROM accounts""")

    result = compute(floor(t.amount), s)
    assert normalize(str(result)) == normalize("""
            SELECT floor(accounts.amount) as amount
            FROM accounts""")

    result = compute(t.amount // 2, s)
    assert normalize(str(result)) == normalize("""
            SELECT floor(accounts.amount / :amount_1) AS amount
            FROM accounts""")
Exemplo n.º 3
0
def test_floor_ceil(bank):
    t = symbol('t', discover(bank))
    assert set(compute(200 * floor(t.amount / 200), bank)) == set([0, 200])
    assert set(compute(200 * ceil(t.amount / 200), bank)) == set([200, 400])
Exemplo n.º 4
0
def test_floor_ceil(bank):
    t = symbol('t', discover(bank))
    assert set(compute(200 * floor(t.amount / 200), bank)) == set([0, 200])
    assert set(compute(200 * ceil(t.amount / 200), bank)) == set([200, 400])