Fokko commented on code in PR #5201:
URL: https://github.com/apache/iceberg/pull/5201#discussion_r918782797


##########
python/tests/table/test_snapshots.py:
##########
@@ -0,0 +1,98 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from pyiceberg.table.snapshots import Operation, Snapshot, Summary
+
+
+def test_serialize_summary():
+    assert Summary(Operation.APPEND).json() == """{"operation": "append"}"""
+
+
+def test_serialize_summary_with_properties():
+    assert Summary(Operation.APPEND, property="yes").json() == 
"""{"operation": "append", "property": "yes"}"""
+
+
+def test_serialize_snapshot():
+    snapshot = Snapshot(
+        snapshot_id=25,
+        parent_snapshot_id=19,
+        sequence_number=200,

Review Comment:
   Good catch, I've added a test. I noticed that in Java we set the sequence 
number to zero. I tried to do this in Python as well, but then we don't want to 
write the value. Turns out that setting it to `None` makes it easier since we 
don't write `None` keys in the json object (similar to doc in the NestedField).
   I don't think this is an issue, but we should add a check when we start 
modifying the snapshots.



-- 
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