petern48 commented on code in PR #476:
URL: https://github.com/apache/sedona-db/pull/476#discussion_r2660420266


##########
python/sedonadb/tests/functions/test_functions.py:
##########
@@ -827,17 +827,70 @@ def test_st_convexhull(eng, geom, expected):
             "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))",
         ),
+        # Z and M support
+        ("POINT Z (0 0 0)", "POINT Z(0 0 0)"),
+        ("POINT M (1 2 3)", "POINT M(1 2 3)"),
+        ("POINT ZM (1 2 3 4)", "POINT ZM(1 2 3 4)"),
+        ("LINESTRING Z (0 0 0, 1 1 1)", "LINESTRING Z(0 0 0,1 1 1)"),
+        ("LINESTRING M (0 0 1, 1 1 2)", "LINESTRING M(0 0 1,1 1 2)"),
+        ("LINESTRING ZM (0 0 1 2, 1 1 3 4)", "LINESTRING ZM(0 0 1 2,1 1 3 4)"),
+        (
+            "POLYGON Z ((0 0 10, 4 0 10, 4 4 10, 0 4 10, 0 0 10))",
+            "POLYGON Z((0 0 10,4 0 10,4 4 10,0 4 10,0 0 10))",
+        ),
+        (
+            "POLYGON M ((0 0 1, 4 0 2, 4 4 3, 0 4 4, 0 0 5))",
+            "POLYGON M((0 0 1,4 0 2,4 4 3,0 4 4,0 0 5))",
+        ),
+        (
+            "POLYGON ZM ((0 0 10 1, 4 0 10 2, 4 4 10 3, 0 4 10 4, 0 0 10 5))",
+            "POLYGON ZM((0 0 10 1,4 0 10 2,4 4 10 3,0 4 10 4,0 0 10 5))",
+        ),
+        ("MULTIPOINT Z ((0 0 0), (1 1 1))", "MULTIPOINT Z((0 0 0),(1 1 1))"),
+        ("MULTIPOINT M ((0 0 1), (1 1 2))", "MULTIPOINT M((0 0 1),(1 1 2))"),
+        ("MULTIPOINT ZM ((0 0 1 2), (1 1 3 4))", "MULTIPOINT ZM((0 0 1 2),(1 1 
3 4))"),
+        # Polygons overlap, so it's reduced to a single one
+        (
+            "MULTIPOLYGON Z (((0 0 10, 4 0 10, 4 4 10, 0 4 10, 0 0 10)), ((1 1 
5, 1 2 5, 2 2 5, 2 1 5, 1 1 5)))",
+            "POLYGON Z((0 4 10,4 4 10,4 0 10,0 0 10,0 4 10))",
+        ),
+        # Skipping M and ZM tests because library is not smart enough for M 
dimensions yet. (specifies NaN instead)
+        (
+            "GEOMETRYCOLLECTION Z(POINT Z(1 2 3), LINESTRING Z(0 0 0,1 1 1))",
+            "GEOMETRYCOLLECTION Z(POINT Z(1 2 3),LINESTRING Z(0 0 0,1 1 1))",
+        ),
+        # dimension specified on nested geometries, but not outer 
geometrycollection
+        (
+            "GEOMETRYCOLLECTION (POINT Z(1 2 3), LINESTRING Z(0 0 0,1 1 1))",
+            "GEOMETRYCOLLECTION Z(POINT Z(1 2 3),LINESTRING Z(0 0 0,1 1 1))",
+        ),
+        # Skipping M and ZM tests because library is not smart enough for 
GeometryCollection M yet , specifies NaN instead)
     ],
 )
 def test_st_unaryunion(eng, geom, expected):
+    is_postgis = eng == PostGIS
     eng = eng.create_or_skip()
 
     if expected is None:
         eng.assert_query_result(f"SELECT ST_UnaryUnion({geom_or_null(geom)})", 
expected)
+    # PostGIS doesn't support M dimensions so we skip the test
+    elif is_postgis and (" M" in expected or "ZM" in expected):

Review Comment:
   I moved the ZM tests to a separate test, this exact if condition though 
still remains in that new test since I still want to test postgis on the Z 
cases. personally like it this way rather than pulling it out into a separate Z 
and M test. though let me know if you feel strongly otherwise



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

Reply via email to