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


##########
tests/table/test_partitioning.py:
##########
@@ -112,6 +112,36 @@ def test_unpartitioned() -> None:
 def test_serialize_unpartitioned_spec() -> None:
     assert UNPARTITIONED_PARTITION_SPEC.model_dump_json() == 
"""{"spec-id":0,"fields":[]}"""
 
+def test_always_true_serializes_to_json_true():
+    expr = AlwaysTrue()
+    assert expr.model_dump_json() == "true"
+
+def test_always_false_serializes_to_json_false():
+    expr = AlwaysFalse()
+    assert expr.model_dump_json() == "false"
+
+def test_serialize_partition_spec_trye() -> None:
+    partitioned = PartitionSpec(
+        PartitionField(source_id=1, field_id=1000, 
transform=TruncateTransform(width=19), name="str_truncate"),
+        PartitionField(source_id=2, field_id=1001, 
transform=BucketTransform(num_buckets=25), name="int_bucket"),
+        spec_id=3,
+    )
+    assert (
+        partitioned.model_dump_json()
+        == 
"""{"spec-id":3,"fields":[{"source-id":1,"field-id":1000,"transform":"truncate[19]","name":"str_truncate"},{"source-id":2,"field-id":1001,"transform":"bucket[25]","name":"int_bucket"}]}"""
+    )
+
+def test_serialize_partition_spec() -> None:
+    partitioned = PartitionSpec(
+        PartitionField(source_id=1, field_id=1000, 
transform=TruncateTransform(width=19), name="str_truncate"),
+        PartitionField(source_id=2, field_id=1001, 
transform=BucketTransform(num_buckets=25), name="int_bucket"),
+        spec_id=3,
+    )
+    assert (
+        partitioned.model_dump_json()
+        == 
"""{"spec-id":3,"fields":[{"source-id":1,"field-id":1000,"transform":"truncate[19]","name":"str_truncate"},{"source-id":2,"field-id":1001,"transform":"bucket[25]","name":"int_bucket"}]}"""
+    )
+

Review Comment:
   I think these are copy-paste:
   
   ```suggestion
   ```



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