def test_from_to_buffer(example_df: pl.DataFrame, compressions: List[str]) -> None: for compression in compressions: buf = io.BytesIO() example_df.write_avro(buf, compression=compression) # type: ignore buf.seek(0) read_df = pl.read_avro(buf) assert example_df.frame_equal(read_df)
def test_select_projection() -> None: df = pl.DataFrame({ "a": [1, 2, 3], "b": [True, False, True], "c": ["a", "b", "c"] }) expected = pl.DataFrame({"b": [True, False, True], "c": ["a", "b", "c"]}) f = io.BytesIO() df.write_avro(f) f.seek(0) read_df = pl.read_avro(f, columns=[1, 2]) assert expected.frame_equal(read_df)