def test_encode_chunks_with_chunksize_none(): df = pandas.DataFrame(numpy.random.randn(6, 4), index=range(6)) chunks = list(load.encode_chunks(df)) assert len(chunks) == 1 remaining, buffer = chunks[0] assert remaining == 0 assert len(buffer.readlines()) == 6
def test_encode_chunks_splits_dataframe(): df = pandas.DataFrame(numpy.random.randn(6, 4), index=range(6)) chunks = list(load.encode_chunks(df, chunksize=2)) assert len(chunks) == 3 remaining, buffer = chunks[0] assert remaining == 4 assert len(buffer.readlines()) == 2