Fokko commented on code in PR #4620:
URL: https://github.com/apache/iceberg-python/pull/4620#discussion_r4805615769


##########
tests/table/test_inspect.py:
##########
@@ -308,3 +308,12 @@ def 
test_inspect_after_promoting_then_dropping_partition_column(catalog: InMemor
     assert tbl.inspect.manifests().to_pydict()["partition_summaries"][0] == [
         {"contains_null": False, "contains_nan": False, "lower_bound": "10", 
"upper_bound": "20"}
     ]
+
+
+def 
test_inspect_files_with_snapshot_id_zero_on_table_without_snapshots(catalog: 
InMemoryCatalog) -> None:
+    tbl = catalog.create_table("default.no_snapshots", Schema(NestedField(1, 
"x", LongType(), required=False)))
+
+    for inspect_files in [tbl.inspect.files, tbl.inspect.data_files, 
tbl.inspect.delete_files]:
+        assert inspect_files().num_rows == 0
+        with pytest.raises(ValueError, match="Cannot find snapshot with ID 0"):
+            inspect_files(snapshot_id=0)

Review Comment:
   Nit: could you use `@pytest.mark.parametrize` here instead of a loop?
   
   ```suggestion
   @pytest.mark.parametrize("inspect_files", [InspectTable.files.fget, 
InspectTable.data_files.fget, InspectTable.delete_files.fget])
   def test_inspect_files_with_snapshot_id_zero_on_table_without_snapshots(
       catalog: InMemoryCatalog, inspect_files
   ) -> None:
       tbl = catalog.create_table("default.no_snapshots", Schema(NestedField(1, 
"x", LongType(), required=False)))
   
       assert inspect_files(tbl).num_rows == 0
       with pytest.raises(ValueError, match="Cannot find snapshot with ID 0"):
           inspect_files(tbl, snapshot_id=0)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to