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


##########
python/sedonadb/tests/functions/test_functions.py:
##########
@@ -2698,3 +2698,49 @@ def test_st_snap(eng, input, reference, tolerance, 
expected):
 def test_st_zmflag(eng, geom, expected):
     eng = eng.create_or_skip()
     eng.assert_query_result(f"SELECT ST_ZmFlag({geom_or_null(geom)})", 
expected)
+
+
[email protected]("eng", [SedonaDB, PostGIS])
[email protected](
+    ("geom", "expected"),
+    [
+        # input -> #output postgis returned
+        (None, None),  # none
+        ("POINT (1 2)", None),  # none
+        ("LINESTRING (0 0, 1 1, 2 2)", None),  # non-polygon -> NULL
+        ("POLYGON EMPTY", 0),  # empty polygon has no interior rings
+        ("POLYGON ((0 0, 4 0, 4 4, 0 4, 0 0))", 0),  # simple polygon, no holes
+        # example query - SELECT 
ST_NumInteriorRings(ST_GeomFromText('POLYGON((0 0,4 0,4 4,0 4,0 0))')) AS 
num_rings;
+        (
+            "POLYGON (\
+                (0 0,6 0,6 6,0 6,0 0),\
+                (2 2,4 2,4 4,2 4,2 2))",

Review Comment:
   ```suggestion
               "POLYGON ((0 0,6 0,6 6,0 6,0 0), (2 2,4 2,4 4,2 4,2 2))"
   ```
   
   It's slightly more convenient to write geometries on a single line. It makes 
it easier to copy-paste for testing on the PostGIS container I mentioned above. 
I suggest doing this with your other python tests to help you debug easier. 
This way, you also won't have to worry about backslashes and issues with 
multiline python strings.



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