|
35 | 35 | write_manifest,
|
36 | 36 | write_manifest_list,
|
37 | 37 | )
|
38 |
| -from pyiceberg.partitioning import PartitionField, PartitionSpec |
| 38 | +from pyiceberg.partitioning import UNPARTITIONED_PARTITION_SPEC, PartitionField, PartitionSpec |
39 | 39 | from pyiceberg.schema import Schema
|
40 | 40 | from pyiceberg.table.snapshots import Operation, Snapshot, Summary
|
41 | 41 | from pyiceberg.transforms import IdentityTransform
|
@@ -306,6 +306,23 @@ def test_read_manifest_v2(generated_manifest_file_file_v2: str) -> None:
|
306 | 306 | assert entry.status == ManifestEntryStatus.ADDED
|
307 | 307 |
|
308 | 308 |
|
| 309 | +def test_write_empty_manifest() -> None: |
| 310 | + io = load_file_io() |
| 311 | + test_schema = Schema(NestedField(1, "foo", IntegerType(), False)) |
| 312 | + with TemporaryDirectory() as tmpdir: |
| 313 | + tmp_avro_file = tmpdir + "/test_write_manifest.avro" |
| 314 | + |
| 315 | + with pytest.raises(ValueError, match="An empty manifest file has been written"): |
| 316 | + with write_manifest( |
| 317 | + format_version=1, |
| 318 | + spec=UNPARTITIONED_PARTITION_SPEC, |
| 319 | + schema=test_schema, |
| 320 | + output_file=io.new_output(tmp_avro_file), |
| 321 | + snapshot_id=8744736658442914487, |
| 322 | + ) as _: |
| 323 | + pass |
| 324 | + |
| 325 | + |
309 | 326 | @pytest.mark.parametrize("format_version", [1, 2])
|
310 | 327 | def test_write_manifest(
|
311 | 328 | generated_manifest_file_file_v1: str, generated_manifest_file_file_v2: str, format_version: TableVersion
|
|
0 commit comments