Ejemplo 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')
Ejemplo 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')
Ejemplo 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")
Ejemplo n.º 4
0
def test_neg_dshape_unsigned():
    y = symbol('y', 'uint32')
    assert (-y).dshape == dshape('int32')
Ejemplo 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)
Ejemplo n.º 6
0
def test_neg_dshape_unsigned():
    y = symbol("y", "uint32")
    assert (-y).dshape == dshape("int32")
Ejemplo n.º 7
0
def test_neg_dshape_unsigned():
    y = symbol('y', 'uint32')
    assert (-y).dshape == dshape('int32')
Ejemplo 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)
Ejemplo 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')
Ejemplo 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)
Ejemplo 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}")
Ejemplo 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")
Ejemplo n.º 13
0
def test_scalar_name_dtype():
    x = symbol("x", "int64")
    assert x._name == "x"
    assert x.dshape == dshape("int64")
Ejemplo n.º 14
0
def test_arithmetic_dshape_inference():
    x = symbol("x", "int")
    y = symbol("y", "int")
    assert (x + y).dshape == dshape("int")
Ejemplo n.º 15
0
def test_arithmetic_dshape_inference():
    x = symbol('x', 'int')
    y = symbol('y', 'int')
    assert (x + y).dshape == dshape('int')
Ejemplo n.º 16
0
def test_scalar_name_dtype():
    x = symbol('x', 'int64')
    assert x._name == 'x'
    assert x.dshape == dshape('int64')
Ejemplo 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
Ejemplo 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}')
Ejemplo n.º 19
0
def test_scalar_name_dtype():
    x = symbol('x', 'int64')
    assert x._name == 'x'
    assert x.dshape == dshape('int64')
Ejemplo 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')
Ejemplo 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}')
Ejemplo n.º 22
0
def test_arithmetic_dshape_inference():
    x = symbol('x', 'int')
    y = symbol('y', 'int')
    assert (x + y).dshape == dshape('int')
Ejemplo 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