apache / apache/sedona

chore(geopandas): Add more edge cases to the `test_match_geopandas_series.py` suite

Open
#2,392 3 comments 0 reactions 0 assignees View on GitHub
good first issue sedona-geopandas sedona-python
Dominant language
Java
Stars
2.4k
Forks
784
Avg merge
1d 12h
Merged PRs (30d)
58

Description

`test_match_geopandas_series.py` is where we compare that our results match the results of geopandas. We reuse the same lists of geometries (e.g `self.linestrings`, `self.geoms`, etc) in nearly every test. I wrote these cases very early and failed to consider various edge cases. In this issue, I'd like to add some test cases to these lists (e.g `self.linestrings`). I wouldn't be surprised if we fail some of these.

Here are the edge cases I think we should add. I think each of these should be their own PR, since it's possible that they cause test failures and require us to modify the implementation of existing sedona geopandas functions.
- empty geometries (e.g `POINT EMPTY`)
- non-valid polygons (e.g `POLYGON((0 0, 0 1, 2 1, 2 2, 1 2, 1 0, 0 0))`, see [here](https://postgis.net/workshops/postgis-intro/validity.html) to learn about validity)
- GeometryCollections cases (apparently, there's only [one case](https://github.com/apache/sedona/blob/6dc39e753b9d2087d27d2a6072b95d3eda91c53f/python/tests/geopandas/test_match_geopandas_series.py#L92) at the moment...)
- geom with only empty geometries
- geom collection w/ only a single geom (e.g is_closed only applies to linestrings, should it return true for this GeomCol (< a single closed linestring >)?
- Z and M dimensions for everything
- CRS
- Other geometry types that Sedona doesn't support (e.g [LinearRing](https://shapely.readthedocs.io/en/2.1.1/reference/shapely.LinearRing.html#shapely.LinearRing), [box](https://shapely.readthedocs.io/en/2.1.1/manual.html#shapely.geometry.box))

Here's an example of the current cases (and hence where we would need to add more cases).
https://github.com/apache/sedona/blob/6dc39e753b9d2087d27d2a6072b95d3eda91c53f/python/tests/geopandas/test_match_geopandas_series.py#L59-L67

Contributor guide

Open the contributing guide

Research direction

Start with python/tests/geopandas/test_match_geopandas_series.py, especially the shared geometry lists around lines 59-67 and the existing GeometryCollection case near line 92. Run this suite first, then choose one listed edge-case group for its own change. Done means the relevant cases are covered and the comparison tests pass, with implementation changes only if the new cases expose failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.