Exemple #1
0
def test_Projection():
    t = TableSymbol('t', '{name: string, amount: int, id: int32}')
    p = projection(t, ['amount', 'name'])
    assert p.schema == dshape('{amount: int32, name: string}')
    print(t['amount'].dshape)
    print(dshape('var * int32'))
    assert t['amount'].dshape == dshape('var * {amount: int32}')

    assert eval(str(p)).isidentical(p)
Exemple #2
0
def test_Projection():
    t = TableSymbol('t', '{name: string, amount: int, id: int32}')
    p = projection(t, ['amount', 'name'])
    assert p.schema == dshape('{amount: int32, name: string}')
    print(t['amount'].dshape)
    print(dshape('var * int32'))
    assert t['amount'].dshape == dshape('var * {amount: int32}')

    assert eval(str(p)).isidentical(p)
    assert p.project(['amount','name']) == p[['amount','name']]
    with pytest.raises(ValueError):
        p.project('balance')
Exemple #3
0
def test_Projection():
    t = symbol('t', 'var * {name: string, amount: int, id: int32}')
    p = projection(t, ['amount', 'name'])
    assert p.schema == dshape('{amount: int32, name: string}')
    print(t['amount'].dshape)
    print(dshape('var * int32'))
    assert t['amount'].dshape == dshape('var * int32')
    assert t['amount']._name == 'amount'

    assert eval(str(p)).isidentical(p)
    assert p._project(['amount', 'name']) == p[['amount', 'name']]
    with pytest.raises(ValueError):
        p._project('balance')
Exemple #4
0
def test_Projection():
    t = TableSymbol("t", "{name: string, amount: int, id: int32}")
    p = projection(t, ["amount", "name"])
    assert p.schema == dshape("{amount: int32, name: string}")
    print(t["amount"].dshape)
    print(dshape("var * int32"))
    assert t["amount"].dshape == dshape("var * int32")
    assert t["amount"]._name == "amount"

    assert eval(str(p)).isidentical(p)
    assert p._project(["amount", "name"]) == p[["amount", "name"]]
    with pytest.raises(ValueError):
        p._project("balance")
Exemple #5
0
def test_indexing():
    t = TableSymbol('t', '{name: string, amount: int, id: int}')
    assert t[['amount', 'id']] == projection(t, ['amount', 'id'])
    assert t['amount'].isidentical(Field(t, 'amount'))
Exemple #6
0
def test_indexing():
    t = symbol('t', 'var * {name: string, amount: int, id: int}')
    assert t[['amount', 'id']] == projection(t, ['amount', 'id'])
    assert t['amount'].isidentical(Field(t, 'amount'))
Exemple #7
0
def test_indexing():
    t = TableSymbol("t", "{name: string, amount: int, id: int}")
    assert t[["amount", "id"]] == projection(t, ["amount", "id"])
    assert t["amount"].isidentical(Field(t, "amount"))