def test_symbol_printing_is_legible(): accounts = symbol('accounts', 'var * {name: string, balance: int, id: int}') expr = (exp(accounts.balance * 10)) + accounts['id'] assert "exp(accounts.balance * 10)" in str(expr) assert "+ accounts.id" in str(expr)
def test_TableSymbol_printing_is_legible(): accounts = TableSymbol('accounts', '{name: string, balance: int, id: int}') expr = (exp(accounts['balance'] * 10)) + accounts['id'] assert "exp(accounts['balance'] * 10)" in str(expr) assert "+ accounts['id']" in str(expr)
def test_unary_ops(): t = TableSymbol('t', '{name: string, amount: int}') expr = cos(exp(t['amount'])) assert 'cos' in str(expr) assert '~' in str(~(t.amount > 0))
def test_unary_op(): assert (compute(exp(t['amount']), df) == np.exp(df['amount'])).all()
def test_unary_ops(): t = symbol('t', 'var * {name: string, amount: int}') expr = cos(exp(t['amount'])) assert 'cos' in str(expr) assert '~' in str(~(t.amount > 0))
def test_UnaryOp(): assert eq(compute(exp(t['amount']), x), np.exp(x['amount']))
def test_UnaryOp(): assert eq(compute(exp(t['amount']), x), np.exp(x['amount'])) assert eq(compute(abs(-t['amount']), x), abs(-x['amount']))
def test_unary_op(): assert str(compute(exp(t['amount']), s, post_compute=False)) == \ str(sa.func.exp(s.c.amount)) assert str(compute(-t['amount'], s, post_compute=False)) == \ str(-s.c.amount)
def test_UnaryOp(): assert eq(compute(exp(t["amount"]), x), np.exp(x["amount"])) assert eq(compute(abs(-t["amount"]), x), abs(-x["amount"]))
def test_TableSymbol_printing_is_legible(): accounts = TableSymbol("accounts", "{name: string, balance: int, id: int}") expr = (exp(accounts.balance * 10)) + accounts["id"] assert "exp(accounts.balance * 10)" in str(expr) assert "+ accounts.id" in str(expr)
def test_unary_ops(): t = TableSymbol("t", "{name: string, amount: int}") expr = cos(exp(t["amount"])) assert "cos" in str(expr) assert "~" in str(~(t.amount > 0))