@@ -2714,6 +2714,7 @@ def test_st_pointm(eng, x, y, m, expected):
27142714 ],
27152715)
27162716def test_st_points (eng , geometry , expected , expected_n ):
2717+ is_postgis = eng is PostGIS
27172718 eng = eng .create_or_skip ()
27182719 eng .assert_query_result (
27192720 f"SELECT ST_Points({ geom_or_null (geometry )} )" ,
@@ -2723,6 +2724,13 @@ def test_st_points(eng, geometry, expected, expected_n):
27232724 f"SELECT ST_NPoints({ geom_or_null (geometry )} )" ,
27242725 expected_n ,
27252726 )
2727+ if not is_postgis :
2728+ # ST_NumPoints is an alias for ST_NPoints in SedonaDB.
2729+ # PostGIS still treats ST_NumPoints as LineString-only despite documentation.
2730+ eng .assert_query_result (
2731+ f"SELECT ST_NumPoints({ geom_or_null (geometry )} )" ,
2732+ expected_n ,
2733+ )
27262734
27272735
27282736@pytest .mark .parametrize ("eng" , [SedonaDB , PostGIS ])
@@ -3876,38 +3884,6 @@ def test_st_numinteriorrings_basic(eng, geom, expected):
38763884 )
38773885
38783886
3879- @pytest .mark .parametrize ("eng" , [SedonaDB , PostGIS ])
3880- @pytest .mark .parametrize (
3881- ("geom" , "expected" ),
3882- [
3883- (None , None ),
3884- ("POINT EMPTY" , None ),
3885- ("LINESTRING EMPTY" , 0 ),
3886- ("POLYGON EMPTY" , None ),
3887- ("MULTIPOINT EMPTY" , None ),
3888- ("MULTILINESTRING EMPTY" , None ),
3889- ("MULTIPOLYGON EMPTY" , None ),
3890- ("GEOMETRYCOLLECTION EMPTY" , None ),
3891- ("POINT (1 2)" , None ),
3892- ("LINESTRING (0 0, 1 1, 2 2)" , 3 ),
3893- ("LINESTRING (0 0, 1 1, 0 0)" , 3 ),
3894- ("LINESTRING Z (0 0 0, 1 1 1, 2 2 2, 3 3 3)" , 4 ),
3895- ("LINESTRING M (0 0 0, 1 1 1, 2 2 2, 3 3 3)" , 4 ),
3896- ("LINESTRING ZM (0 0 0 2, 1 1 1 4)" , 2 ),
3897- ("POLYGON ((0 0, 4 0, 4 4, 0 4, 0 0))" , None ),
3898- ("MULTILINESTRING ((0 0, 0 1, 1 1, 0 0),(0 0, 1 1))" , None ),
3899- ("GEOMETRYCOLLECTION (LINESTRING (0 0, 0 1, 1 1, 0 0))" , None ),
3900- ("POLYGON ((0 0,6 0,6 6,0 6,0 0),(2 2,4 2,4 4,2 4,2 2))" , None ),
3901- ],
3902- )
3903- def test_st_numpoints (eng , geom , expected ):
3904- eng = eng .create_or_skip ()
3905- eng .assert_query_result (
3906- f"SELECT ST_NumPoints({ geom_or_null (geom )} )" ,
3907- expected ,
3908- )
3909-
3910-
39113887@pytest .mark .parametrize ("eng" , [SedonaDB , PostGIS ])
39123888@pytest .mark .parametrize (
39133889 ("geom" , "expected" ),
0 commit comments