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']
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}))
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']
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)
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)
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"]