paleolimbot commented on code in PR #234:
URL: https://github.com/apache/sedona-db/pull/234#discussion_r2452914034
##########
python/sedonadb/tests/functions/test_functions.py:
##########
@@ -284,6 +284,36 @@ def test_st_convexhull(eng, geom, expected):
eng.assert_query_result(f"SELECT ST_ConvexHull({geom_or_null(geom)})",
expected)
[email protected]("eng", [SedonaDB, PostGIS])
[email protected](
+ ("geom", "expected"),
+ [
+ (None, None),
+ ("POINT (0 0)", "POINT (0 0)"),
+ ("POINT EMPTY", "POINT (nan nan)"),
+ ("LINESTRING (0 0, 1 1, 2 2)", "LINESTRING (0 0, 1 1, 2 2)"),
+ ("LINESTRING EMPTY", "LINESTRING EMPTY"),
+ ("POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))", "POLYGON ((0 0, 1 0, 1 1, 0 1,
0 0))"),
+ ("MULTIPOINT ((0 0), (1 1), (2 2))", "MULTIPOINT (0 0, 1 1, 2 2)"),
+ (
+ "MULTIPOLYGON (((0 0, 1 0, 1 1, 0 1, 0 0)), ((1 0, 2 0, 2 1, 1 1,
1 0)))",
+ "POLYGON ((0 0, 0 1, 1 1, 2 1, 2 0, 1 0, 0 0))",
+ ),
+ (
+ "MULTIPOLYGON (((0 0, 1 0, 1 1, 0 1, 0 0)), ((2 2, 3 2, 3 3, 2 3,
2 2)))",
+ "MULTIPOLYGON (((0 1, 1 1, 1 0, 0 0, 0 1)), ((2 3, 3 3, 3 2, 2 2,
2 3)))",
+ ),
+ (
+ "GEOMETRYCOLLECTION (POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)), POLYGON
((1 0, 2 0, 2 1, 1 1, 1 0)))",
+ "POLYGON ((0 0, 0 1, 1 1, 2 1, 2 0, 1 0, 0 0))",
+ ),
+ ],
+)
+def test_st_unaryunion(eng, geom, expected):
+ eng = eng.create_or_skip()
+ eng.assert_query_result(f"SELECT ST_UnaryUnion({geom_or_null(geom)})",
expected)
Review Comment:
Instead of modifying the assertion code, how about this:
```suggestion
eng.assert_query_result(f"SELECT
ST_Equals(ST_UnaryUnion({geom_or_null(geom)}), geom_or_null(expected))", True)
```
(ST_Equals should compare for topological equality which I think is what
you're hoping for)
--
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]