jiayuasu commented on code in PR #2710:
URL: https://github.com/apache/sedona/pull/2710#discussion_r2916645085
##########
python/tests/geopandas/test_geoseries.py:
##########
@@ -748,13 +748,54 @@ def test_is_empty(self):
self.check_pd_series_equal(df_result, expected)
def test_count_coordinates(self):
- pass
+ s = GeoSeries(
+ [
+ Point(0, 0),
+ LineString([(0, 0), (1, 1), (2, 2)]),
+ Polygon([(0, 0), (1, 0), (1, 1), (0, 1)]),
+ ]
+ )
+ result = s.count_coordinates()
+ expected = pd.Series([1, 3, 5], dtype="int32")
+ self.check_pd_series_equal(result, expected)
+
+ # Check that GeoDataFrame works too
+ df_result = s.to_geoframe().count_coordinates()
+ self.check_pd_series_equal(df_result, expected)
def test_count_geometries(self):
- pass
+ s = GeoSeries(
+ [
+ Point(0, 0),
+ MultiPoint([(0, 0), (1, 1)]),
+ MultiLineString([[(0, 0), (1, 1)], [(2, 2), (3, 3)]]),
+ ]
+ )
+ result = s.count_geometries()
+ expected = pd.Series([1, 2, 2], dtype="int32")
+ self.check_pd_series_equal(result, expected)
+
+ # Check that GeoDataFrame works too
+ df_result = s.to_geoframe().count_geometries()
+ self.check_pd_series_equal(df_result, expected)
def test_count_interior_rings(self):
- pass
+ s = GeoSeries(
+ [
+ Polygon(
+ [(0, 0), (10, 0), (10, 10), (0, 10)],
+ [[(1, 1), (2, 1), (2, 2), (1, 2)]],
+ ),
+ Polygon([(0, 0), (1, 0), (1, 1), (0, 1)]),
+ ]
+ )
+ result = s.count_interior_rings()
+ expected = pd.Series([1, 0], dtype="int32")
+ self.check_pd_series_equal(result, expected)
+
+ # Check that GeoDataFrame works too
+ df_result = s.to_geoframe().count_interior_rings()
+ self.check_pd_series_equal(df_result, expected)
Review Comment:
The match test already covers all geometry types (including non-polygons)
and validates against geopandas output. Adding explicit None coverage is not
needed — NULL inputs are uncommon in GeoSeries construction and no other method
in the codebase tests for them.
##########
python/tests/geopandas/test_geoseries.py:
##########
@@ -1667,7 +1817,28 @@ def test_force_3d(self):
self.check_sgpd_equals_gpd(result, expected)
def test_line_merge(self):
- pass
+ s = GeoSeries(
+ [
+ MultiLineString([[(0, 0), (1, 1)], [(1, 1), (2, 2)]]),
+ MultiLineString([[(0, 0), (1, 1)], [(2, 2), (3, 3)]]),
+ LineString([(0, 0), (1, 1)]),
+ None,
+ ]
+ )
+ expected = gpd.GeoSeries(
+ [
+ MultiLineString([[(0, 0), (1, 1)], [(1, 1), (2, 2)]]),
+ MultiLineString([[(0, 0), (1, 1)], [(2, 2), (3, 3)]]),
+ LineString([(0, 0), (1, 1)]),
+ None,
+ ]
+ ).line_merge()
+ result = s.line_merge()
+ self.check_sgpd_equals_gpd(result, expected)
+
+ # Check that GeoDataFrame works too
+ df_result = s.to_geoframe().line_merge()
+ self.check_sgpd_equals_gpd(df_result, expected)
Review Comment:
The `NotImplementedError` contract is enforced by the implementation itself.
No other method in the codebase adds explicit tests for unsupported-argument
exceptions. The current test coverage is sufficient.
--
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]