joonaspessi commented on code in PR #243:
URL: https://github.com/apache/sedona-db/pull/243#discussion_r2462946760


##########
python/sedonadb/tests/functions/test_functions.py:
##########
@@ -1399,3 +1399,49 @@ def test_st_isvalidreason(eng, geom, expected):
     else:
         query = f"SELECT ST_IsValidReason({geom_or_null(geom)})"
         eng.assert_query_result(query, expected)
+
+
[email protected]("eng", [SedonaDB, PostGIS])
[email protected](
+    ("geom", "tolerance", "expected"),
+    [
+        # Basic linestring simplification
+        (
+            "LINESTRING (0 0, 0 10, 0 51, 50 20, 30 20, 7 32)",
+            2,
+            "LINESTRING(0 0,0 51,50 20,30 20,7 32)",
+        ),
+        # Short linestring preserves endpoints
+        (
+            "LINESTRING (0 0, 0 10)",
+            20,
+            "LINESTRING(0 0,0 10)",
+        ),
+        # Null handling
+        (None, 2, None),
+        (None, None, None),
+        ("LINESTRING (0 0, 0 10)", None, None),
+        # Empty geometries
+        ("LINESTRING EMPTY", 2, "LINESTRING EMPTY"),
+        ("POINT EMPTY", 2, "POINT EMPTY"),
+        ("POLYGON EMPTY", 2, "POLYGON EMPTY"),
+        # POLYGON with hole - topology preserved, both rings simplified
+        (
+            "POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0),(5 5, 5 6, 6 6, 8 5, 5 
5))",
+            20,
+            "POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,5 6,8 5,5 5))",

Review Comment:
   Thanks for the suggestion, the consistent spacing indeed made the test case 
much more easier to follow and understand. Also fixed that comment that was 
wrongly stating that both outer and inner rings would be simplified. 



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