Esempio n. 1
0
def test_numbers():
    x = symbol('x', 'real')
    y = symbol('y', 'int')
    for expr in [x + 1, x - 1, x * 1, x + y, x - y, x / y, x * y + x + y,
                 x**y, x**2, 2**x, x % 5, -x,
                 sin(x), cos(x ** 2), exp(log(y))]:
        assert expr.dshape == dshape('real')
        assert eval(str(expr)).isidentical(expr)

    assert (-y).dshape == dshape('int')
Esempio n. 2
0
def test_numbers():
    x = symbol('x', 'real')
    y = symbol('y', 'int')
    for expr in [x + 1, x - 1, x * 1, x + y, x - y, x / y, x * y + x + y,
                 x**y, x**2, 2**x, x % 5, -x,
                 sin(x), cos(x ** 2), exp(log(y))]:
        assert expr.dshape == dshape('real')
        assert eval(str(expr)).isidentical(expr)

    assert (-y).dshape == dshape('int')
Esempio n. 3
0
def test_numbers():
    x = symbol("x", "real")
    y = symbol("y", "int")
    for expr in [
        x + 1,
        x - 1,
        x * 1,
        x + y,
        x - y,
        x / y,
        x * y + x + y,
        x ** y,
        x ** 2,
        2 ** x,
        x % 5,
        -x,
        sin(x),
        cos(x ** 2),
        exp(log(y)),
    ]:
        assert expr.dshape == dshape("real")
        assert eval(str(expr)).isidentical(expr)

    assert (-y).dshape == dshape("int")
Esempio n. 4
0
def test_neg_dshape_unsigned():
    y = symbol('y', 'uint32')
    assert (-y).dshape == dshape('int32')
Esempio n. 5
0
def test_relationals():
    x = symbol('x', 'real')
    for expr in [x < 1, x > 1, x == 1, x != 1, x <= 1, x >= 1, ~b]:
        assert expr.dshape == dshape('bool')
        assert eval(str(expr)).isidentical(expr)
Esempio n. 6
0
def test_neg_dshape_unsigned():
    y = symbol("y", "uint32")
    assert (-y).dshape == dshape("int32")
Esempio n. 7
0
def test_neg_dshape_unsigned():
    y = symbol('y', 'uint32')
    assert (-y).dshape == dshape('int32')
Esempio n. 8
0
def test_relationals():
    x = symbol('x', 'real')
    for expr in [x < 1, x > 1, x == 1, x != 1, x <= 1, x >= 1, ~b]:
        assert expr.dshape == dshape('bool')
        assert eval(str(expr)).isidentical(expr)
Esempio n. 9
0
def test_scalar_field():
    x = symbol('x', '{name: string, amount: int64, when: datetime}')
    assert 'amount' in dir(x)
    assert x.amount.dshape == dshape('int64')
Esempio n. 10
0
def test_relationals():
    x = symbol("x", "real")
    for expr in [x < 1, x > 1, x == 1, x != 1, x <= 1, x >= 1, ~b]:
        assert expr.dshape == dshape("bool")
        assert eval(str(expr)).isidentical(expr)
Esempio n. 11
0
def test_scalar_projection():
    x = symbol("x", "{name: string, amount: int64, when: datetime}")
    assert x[["amount", "when"]].dshape == dshape("{amount: int64, when: datetime}")
Esempio n. 12
0
def test_scalar_field():
    x = symbol("x", "{name: string, amount: int64, when: datetime}")
    assert "amount" in dir(x)
    assert x.amount.dshape == dshape("int64")
Esempio n. 13
0
def test_scalar_name_dtype():
    x = symbol("x", "int64")
    assert x._name == "x"
    assert x.dshape == dshape("int64")
Esempio n. 14
0
def test_arithmetic_dshape_inference():
    x = symbol("x", "int")
    y = symbol("y", "int")
    assert (x + y).dshape == dshape("int")
Esempio n. 15
0
def test_arithmetic_dshape_inference():
    x = symbol('x', 'int')
    y = symbol('y', 'int')
    assert (x + y).dshape == dshape('int')
Esempio n. 16
0
def test_scalar_name_dtype():
    x = symbol('x', 'int64')
    assert x._name == 'x'
    assert x.dshape == dshape('int64')
Esempio n. 17
0
def test_relationals():
    x = Symbol('x', 'real')
    for expr in [x < 1, x > 1, x == 1, x != 1, x <= 1, x >= 1, ~x]:
        assert expr.dshape == dshape('bool')
        assert eval(str(expr)) == expr
Esempio n. 18
0
def test_scalar_projection():
    x = symbol('x', '{name: string, amount: int64, when: datetime}')
    assert x[['amount', 'when']].dshape == \
            dshape('{amount: int64, when: datetime}')
Esempio n. 19
0
def test_scalar_name_dtype():
    x = symbol('x', 'int64')
    assert x._name == 'x'
    assert x.dshape == dshape('int64')
Esempio n. 20
0
def test_scalar_field():
    x = symbol('x', '{name: string, amount: int64, when: datetime}')
    assert 'amount' in dir(x)
    assert x.amount.dshape == dshape('int64')
Esempio n. 21
0
def test_scalar_projection():
    x = symbol('x', '{name: string, amount: int64, when: datetime}')
    assert x[['amount', 'when']].dshape == \
            dshape('{amount: int64, when: datetime}')
Esempio n. 22
0
def test_arithmetic_dshape_inference():
    x = symbol('x', 'int')
    y = symbol('y', 'int')
    assert (x + y).dshape == dshape('int')
Esempio n. 23
0
def test_relationals():
    x = Symbol('x', 'real')
    for expr in [x < 1, x > 1, x == 1, x != 1, x <= 1, x >= 1, ~x]:
        assert expr.dshape == dshape('bool')
        assert eval(str(expr)) == expr