def pre_compute(expr, data, **kwargs): seq = into(Iterator, data, **kwargs) leaf = expr._leaves()[0] return records_to_tuples(leaf.dshape, seq)
def test_records_to_tuples_mismatch_passthrough(): assert records_to_tuples('var * int', 'dummy') == 'dummy'
def test_records_to_tuples(): seq = [{'i': 1, 'f': 1.0}, {'i': 2, 'f': 2.0}] lst = list(records_to_tuples('var * {i: int, f: float64}', seq)) assert lst == [(1, 1.0), (2, 2.0)]