Gawaboumga commented on code in PR #2224:
URL: https://github.com/apache/iceberg-python/pull/2224#discussion_r2232934979
##########
tests/test_types.py:
##########
@@ -499,6 +501,41 @@ def test_repr_binary() -> None:
assert repr(BinaryType()) == "BinaryType()"
+def test_serialization_geography() -> None:
+ assert GeographyType().model_dump_json() == '"geography"'
+
+
+def test_deserialization_geography() -> None:
+ assert GeographyType.model_validate_json('"geography"') == GeographyType()
+ assert GeographyType.model_validate_json('"geography(OGC:CRS84, thomas)"')
== GeographyType(crs="OGC:CRS84",
edge_algorithm=GeographyType.EdgeAlgorithm.THOMAS)
+ assert GeographyType.model_validate_json('"geography(OGC:CRS84)"') ==
GeographyType(crs="OGC:CRS84", edge_algorithm=None)
+
+
+def test_str_geography() -> None:
+ assert str(GeographyType()) == "geography"
+
+
+def test_repr_geography() -> None:
+ assert repr(GeographyType()) == "GeographyType(crs=None,
edge_algorithm=None)"
+
+
+def test_serialization_geometry() -> None:
+ assert GeometryType().model_dump_json() == '"geometry"'
+
+
+def test_deserialization_geometry() -> None:
+ assert GeometryType.model_validate_json('"geometry"') == GeometryType()
+ assert GeometryType.model_validate_json('"geometry(OGC:CRS84)"') ==
GeometryType(crs="OGC:CRS84")
+
+
+def test_str_geometry() -> None:
+ assert str(GeometryType()) == "geometry"
+
+
+def test_repr_geometry() -> None:
+ assert repr(GeometryType()) == "GeometryType(crs=None)"
Review Comment:
In
[Java](https://github.com/apache/iceberg/blob/main/api/src/main/java/org/apache/iceberg/types/Types.java),
they took the position to store nulls, here it was not clear wether `__str__`
should behaved as `ser_model`. Nonetheless, it has been changed for both.
--
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]