Exemplo n.º 1
0
def test_from_to_buffer(df: pl.DataFrame, compressions: List[str]) -> None:
    for compression in compressions:
        buf = io.BytesIO()
        df.write_ipc(buf, compression=compression)  # type: ignore
        buf.seek(0)
        read_df = pl.read_ipc(buf)
        assert df.frame_equal(read_df)
Exemplo n.º 2
0
def test_from_to_buffer(df: pl.DataFrame, compressions: list[str]) -> None:
    for compression in compressions:
        buf = io.BytesIO()
        df.write_ipc(buf, compression=compression)  # type: ignore[arg-type]
        buf.seek(0)
        read_df = pl.read_ipc(buf)
        assert_frame_equal_local_categoricals(df, read_df)
Exemplo n.º 3
0
def test_from_to_file(io_test_dir: str, df: pl.DataFrame,
                      compressions: List[str]) -> None:
    f = os.path.join(io_test_dir, "small.ipc")

    # does not yet work on windows because we hold an mmap?
    if os.name != "nt":
        for compression in compressions:
            df.write_ipc(f, compression=compression)  # type: ignore
            df_read = pl.read_ipc(str(f))
            assert df.frame_equal(df_read)
Exemplo n.º 4
0
def test_from_to_file(io_test_dir: str, df: pl.DataFrame,
                      compressions: list[str]) -> None:
    f_ipc = os.path.join(io_test_dir, "small.ipc")

    # does not yet work on windows because we hold an mmap?
    if os.name != "nt":
        for compression in compressions:
            for f in (str(f_ipc), Path(f_ipc)):
                df.write_ipc(f,
                             compression=compression)  # type: ignore[arg-type]
                df_read = pl.read_ipc(f)  # type: ignore[arg-type]
                assert_frame_equal_local_categoricals(df, df_read)