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