Skip to content

Commit

Permalink
Add test case for python
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinLin666 committed Mar 14, 2024
1 parent fefc7c9 commit 9ae35f0
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions python/tests/test_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,30 @@ def test_local_path(
assert table == sample_data


@pytest.mark.parametrize("engine", ["pyarrow", "rust"])
def test_local_path_with_unsafe_rename(
tmp_path: pathlib.Path,
sample_data: pa.Table,
monkeypatch,
engine: Literal["pyarrow", "rust"],
):
monkeypatch.chdir(tmp_path) # Make tmp_path the working directory
(tmp_path / "path/to/table").mkdir(parents=True)

local_path = "./path/to/table"
storage_opts = {
"allow_unsafe_rename": "true",
}
write_deltalake(
local_path, sample_data, storage_options=storage_opts, engine=engine
)
delta_table = DeltaTable(local_path, storage_options=storage_opts)
assert delta_table.schema().to_pyarrow() == sample_data.schema

table = delta_table.to_pyarrow_table()
assert table == sample_data


@pytest.mark.parametrize("engine", ["pyarrow", "rust"])
def test_roundtrip_metadata(tmp_path: pathlib.Path, sample_data: pa.Table, engine):
write_deltalake(
Expand Down

0 comments on commit 9ae35f0

Please sign in to comment.