Ejemplo n.º 1
0
def test_relabel_join():
    names = TableSymbol('names', '{first: string, last: string}')

    siblings = join(names.relabel({'last': 'left'}),
                    names.relabel({'last': 'right'}), 'first')

    assert siblings.fields == ['first', 'left', 'right']
Ejemplo n.º 2
0
def test_relabel_join():
    names = TableSymbol('names', '{first: string, last: string}')

    siblings = join(names.relabel({'last': 'left'}),
                    names.relabel({'last': 'right'}), 'first')

    assert siblings.fields == ['first', 'left', 'right']
Ejemplo n.º 3
0
def test_relabel_join():
    names = TableSymbol('names', '{first: string, last: string}')

    siblings = join(names.relabel({'first': 'left'}),
                    names.relabel({'first': 'right'}),
                    'last')[['left', 'right']]

    data = [('Alice', 'Smith'),
            ('Bob', 'Jones'),
            ('Charlie', 'Smith')]

    print(set(compute(siblings, {names: data})))
    assert ('Alice', 'Charlie') in set(compute(siblings, {names: data}))
    assert ('Alice', 'Bob') not in set(compute(siblings, {names: data}))
Ejemplo n.º 4
0
def test_relabel():
    t = TableSymbol('t', '{name: string, amount: int32, id: int32}')

    rl = t.relabel({'name': 'NAME', 'id': 'ID'})

    assert eval(str(rl)).isidentical(rl)

    print(rl.columns)
    assert rl.columns == ['NAME', 'amount', 'ID']
Ejemplo n.º 5
0
def test_relabel():
    t = TableSymbol('t', '{name: string, amount: int32, id: int32}')

    rl = t.relabel({'name': 'NAME', 'id': 'ID'})
    rlc = t['amount'].relabel({'amount': 'BALANCE'})

    assert eval(str(rl)).isidentical(rl)

    print(rl.fields)
    assert rl.fields == ['NAME', 'amount', 'ID']

    assert not isscalar(rl.dshape.measure)
    assert isscalar(rlc.dshape.measure)
Ejemplo n.º 6
0
def test_relabel():
    t = TableSymbol('t', '{name: string, amount: int32, id: int32}')

    rl = t.relabel({'name': 'NAME', 'id': 'ID'})
    rlc = t['amount'].relabel({'amount': 'BALANCE'})

    assert eval(str(rl)).isidentical(rl)

    print(rl.fields)
    assert rl.fields == ['NAME', 'amount', 'ID']

    assert not isscalar(rl.dshape.measure)
    assert isscalar(rlc.dshape.measure)
Ejemplo n.º 7
0
def test_relabel():
    t = TableSymbol("t", "{name: string, amount: int32, id: int32}")

    rl = t.relabel({"name": "NAME", "id": "ID"})
    rlc = t["amount"].relabel({"amount": "BALANCE"})

    assert eval(str(rl)).isidentical(rl)

    print(rl.fields)
    assert rl.fields == ["NAME", "amount", "ID"]

    assert not isscalar(rl.dshape.measure)
    assert isscalar(rlc.dshape.measure)
Ejemplo n.º 8
0
def test_relabel_join():
    names = TableSymbol("names", "{first: string, last: string}")

    siblings = join(names.relabel({"last": "left"}), names.relabel({"last": "right"}), "first")

    assert siblings.fields == ["first", "left", "right"]