jiayuasu commented on code in PR #2701:
URL: https://github.com/apache/sedona/pull/2701#discussion_r2910165130
##########
python/tests/geopandas/test_geoseries.py:
##########
@@ -1318,7 +1318,30 @@ def test_set_precision(self):
pass
def test_representative_point(self):
- pass
+ s = GeoSeries(
+ [
+ Polygon([(0, 0), (1, 0), (1, 1), (0, 1)]),
+ LineString([(0, 0), (1, 1), (1, 0)]),
+ Point(0, 0),
+ None,
+ ]
+ )
+ result = s.representative_point()
+ # representative_point returns a point guaranteed to be within the
geometry
+ # We check that each resulting point is within (or on) the original
geometry
+ for i in range(len(result)):
+ if result.iloc[i] is None:
+ assert s.iloc[i] is None
+ else:
+ assert result.iloc[i].geom_type == "Point"
+
Review Comment:
Fixed — the test now compares against `gpd.GeoSeries.representative_point()`
using `self.check_sgpd_equals_gpd()`, which validates both the spatial contract
and exact value match against geopandas output.
##########
python/tests/geopandas/test_geoseries.py:
##########
@@ -1318,7 +1318,30 @@ def test_set_precision(self):
pass
def test_representative_point(self):
- pass
+ s = GeoSeries(
+ [
+ Polygon([(0, 0), (1, 0), (1, 1), (0, 1)]),
+ LineString([(0, 0), (1, 1), (1, 0)]),
+ Point(0, 0),
+ None,
+ ]
+ )
+ result = s.representative_point()
+ # representative_point returns a point guaranteed to be within the
geometry
+ # We check that each resulting point is within (or on) the original
geometry
+ for i in range(len(result)):
+ if result.iloc[i] is None:
+ assert s.iloc[i] is None
+ else:
+ assert result.iloc[i].geom_type == "Point"
+
Review Comment:
Fixed in the latest push — same fix as above. The test now uses
`self.check_sgpd_equals_gpd(result, expected)` to compare against geopandas
output.
--
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]