

def test_by_with_single_field_child():
    x = symbol('x', 'var * int')
    ((chunk, chunk_expr), (agg, agg_expr)) = split(x, by(x, total=x.sum()))
    assert chunk_expr.isidentical(by(chunk, total=chunk.sum()))
    assert agg_expr.isidentical(by(agg[agg.fields[0]], total=agg.total.sum()).relabel({
        agg.fields[0]: 'x',
    }))

dataset/ETHPy150Open blaze/blaze/blaze/expr/tests/test_split.py test_by_with_single_field_child/original