コード例 #1
0
ファイル: test_scalar.py プロジェクト: CaptainAL/Spyder
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')
コード例 #2
0
ファイル: test_scalar.py プロジェクト: wegamekinglc/blaze
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')
コード例 #3
0
ファイル: test_scalar.py プロジェクト: testmana2/blaze
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")
コード例 #4
0
ファイル: test_scalar.py プロジェクト: CaptainAL/Spyder
def test_neg_dshape_unsigned():
    y = symbol('y', 'uint32')
    assert (-y).dshape == dshape('int32')
コード例 #5
0
ファイル: test_scalar.py プロジェクト: CaptainAL/Spyder
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)
コード例 #6
0
ファイル: test_scalar.py プロジェクト: testmana2/blaze
def test_neg_dshape_unsigned():
    y = symbol("y", "uint32")
    assert (-y).dshape == dshape("int32")
コード例 #7
0
ファイル: test_scalar.py プロジェクト: wegamekinglc/blaze
def test_neg_dshape_unsigned():
    y = symbol('y', 'uint32')
    assert (-y).dshape == dshape('int32')
コード例 #8
0
ファイル: test_scalar.py プロジェクト: wegamekinglc/blaze
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)
コード例 #9
0
ファイル: test_scalar.py プロジェクト: wegamekinglc/blaze
def test_scalar_field():
    x = symbol('x', '{name: string, amount: int64, when: datetime}')
    assert 'amount' in dir(x)
    assert x.amount.dshape == dshape('int64')
コード例 #10
0
ファイル: test_scalar.py プロジェクト: testmana2/blaze
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)
コード例 #11
0
ファイル: test_scalar.py プロジェクト: testmana2/blaze
def test_scalar_projection():
    x = symbol("x", "{name: string, amount: int64, when: datetime}")
    assert x[["amount", "when"]].dshape == dshape("{amount: int64, when: datetime}")
コード例 #12
0
ファイル: test_scalar.py プロジェクト: testmana2/blaze
def test_scalar_field():
    x = symbol("x", "{name: string, amount: int64, when: datetime}")
    assert "amount" in dir(x)
    assert x.amount.dshape == dshape("int64")
コード例 #13
0
ファイル: test_scalar.py プロジェクト: testmana2/blaze
def test_scalar_name_dtype():
    x = symbol("x", "int64")
    assert x._name == "x"
    assert x.dshape == dshape("int64")
コード例 #14
0
ファイル: test_scalar.py プロジェクト: testmana2/blaze
def test_arithmetic_dshape_inference():
    x = symbol("x", "int")
    y = symbol("y", "int")
    assert (x + y).dshape == dshape("int")
コード例 #15
0
ファイル: test_scalar.py プロジェクト: CaptainAL/Spyder
def test_arithmetic_dshape_inference():
    x = symbol('x', 'int')
    y = symbol('y', 'int')
    assert (x + y).dshape == dshape('int')
コード例 #16
0
ファイル: test_scalar.py プロジェクト: wegamekinglc/blaze
def test_scalar_name_dtype():
    x = symbol('x', 'int64')
    assert x._name == 'x'
    assert x.dshape == dshape('int64')
コード例 #17
0
ファイル: test_scalar.py プロジェクト: Back2Basics/blaze
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
コード例 #18
0
ファイル: test_scalar.py プロジェクト: wegamekinglc/blaze
def test_scalar_projection():
    x = symbol('x', '{name: string, amount: int64, when: datetime}')
    assert x[['amount', 'when']].dshape == \
            dshape('{amount: int64, when: datetime}')
コード例 #19
0
ファイル: test_scalar.py プロジェクト: CaptainAL/Spyder
def test_scalar_name_dtype():
    x = symbol('x', 'int64')
    assert x._name == 'x'
    assert x.dshape == dshape('int64')
コード例 #20
0
ファイル: test_scalar.py プロジェクト: CaptainAL/Spyder
def test_scalar_field():
    x = symbol('x', '{name: string, amount: int64, when: datetime}')
    assert 'amount' in dir(x)
    assert x.amount.dshape == dshape('int64')
コード例 #21
0
ファイル: test_scalar.py プロジェクト: CaptainAL/Spyder
def test_scalar_projection():
    x = symbol('x', '{name: string, amount: int64, when: datetime}')
    assert x[['amount', 'when']].dshape == \
            dshape('{amount: int64, when: datetime}')
コード例 #22
0
ファイル: test_scalar.py プロジェクト: wegamekinglc/blaze
def test_arithmetic_dshape_inference():
    x = symbol('x', 'int')
    y = symbol('y', 'int')
    assert (x + y).dshape == dshape('int')
コード例 #23
0
ファイル: test_scalar.py プロジェクト: vitan/blaze
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