def test_scalar_arithmetic(): x = ScalarSymbol('x', 'real') y = ScalarSymbol('y', 'real') assert compute(x + y, {x: 2, y: 3}) == 5 assert compute_up(x + y, 2, 3) == 5 assert compute_up(x * y, 2, 3) == 6 assert compute_up(x / y, 6, 3) == 2 assert compute_up(x % y, 4, 3) == 1 assert compute_up(x ** y, 4, 3) == 64 assert compute(x + 1, {x: 2}) == 3 assert compute(x * 2, {x: 2}) == 4 assert compute(1 + x, {x: 2}) == 3 assert compute(2 * x, {x: 2}) == 4 assert compute_up(-x, 1) == -1 assert compute_up(scalar.numbers.sin(x), 1) == math.sin(1)
def test_scalar_arithmetic(): x = Symbol('x', 'real') y = Symbol('y', 'real') assert compute(x + y, {x: 2, y: 3}) == 5 assert compute_up(x + y, 2, 3) == 5 assert compute_up(x * y, 2, 3) == 6 assert compute_up(x / y, 6, 3) == 2 assert compute_up(x % y, 4, 3) == 1 assert compute_up(x**y, 4, 3) == 64 assert compute(x + 1, {x: 2}) == 3 assert compute(x * 2, {x: 2}) == 4 assert compute(1 + x, {x: 2}) == 3 assert compute(2 * x, {x: 2}) == 4 assert compute_up(-x, 1) == -1 assert compute_up(blaze.sin(x), 1) == math.sin(1)
def test_errors(): t = symbol('t', 'var * {foo: int}') with raises(NotImplementedError): compute_up(by(t, count=t.count()), 1)
def test_compute_up_projection(): assert eq(compute_up(t[['name', 'amount']], x), x[['name', 'amount']])
def test_errors(): t = Symbol('t', 'var * {foo: int}') with raises(NotImplementedError): compute_up(by(t, t.count()), 1)
def test_compute_up_projection(): assert eq(compute_up(t[["name", "amount"]], x), x[["name", "amount"]])