|
25 | 25 | from pyiceberg.manifest import ManifestContent, ManifestEntry, ManifestEntryStatus, ManifestFile |
26 | 26 | from pyiceberg.table import Table |
27 | 27 | from pyiceberg.table.snapshots import Operation, Snapshot, Summary |
28 | | -from pyiceberg.table.update.validate import _deleted_data_files, validation_history |
| 28 | +from pyiceberg.table.update.validate import _deleted_data_files, _validate_deleted_data_files, validation_history |
29 | 29 |
|
30 | 30 |
|
31 | 31 | @pytest.fixture |
@@ -197,3 +197,23 @@ def mock_read_manifest_side_effect(self: Snapshot, io: FileIO) -> list[ManifestF |
197 | 197 | ) |
198 | 198 |
|
199 | 199 | assert result == [my_entry] |
| 200 | + |
| 201 | + |
| 202 | +def test_validate_deleted_data_files_raises_on_conflict( |
| 203 | + table_v2_with_extensive_snapshots_and_manifests: tuple[Table, dict[int, list[ManifestFile]]], |
| 204 | +) -> None: |
| 205 | + table, _ = table_v2_with_extensive_snapshots_and_manifests |
| 206 | + oldest_snapshot = table.snapshots()[0] |
| 207 | + newest_snapshot = cast(Snapshot, table.current_snapshot()) |
| 208 | + |
| 209 | + class DummyEntry: |
| 210 | + snapshot_id = 123 |
| 211 | + |
| 212 | + with patch("pyiceberg.table.update.validate._deleted_data_files", return_value=[DummyEntry()]): |
| 213 | + with pytest.raises(ValidationException): |
| 214 | + _validate_deleted_data_files( |
| 215 | + table=table, |
| 216 | + starting_snapshot=newest_snapshot, |
| 217 | + data_filter=None, |
| 218 | + parent_snapshot=oldest_snapshot, |
| 219 | + ) |
0 commit comments