You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sedona.apache.org by ji...@apache.org on 2026/06/26 02:18:10 UTC

(sedona) branch master updated: [GH-3084] Align GeoPandas test comparison by index (results are unordered) (#3085)

This is an automated email from the ASF dual-hosted git repository.

jiayuasu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sedona.git


The following commit(s) were added to refs/heads/master by this push:
     new a0a159cafa [GH-3084] Align GeoPandas test comparison by index (results are unordered) (#3085)
a0a159cafa is described below

commit a0a159cafa89b7e4b92c07ee49ef049621290848
Author: Jia Yu <ji...@apache.org>
AuthorDate: Thu Jun 25 19:18:05 2026 -0700

    [GH-3084] Align GeoPandas test comparison by index (results are unordered) (#3085)
---
 python/tests/geopandas/test_geopandas_base.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/python/tests/geopandas/test_geopandas_base.py b/python/tests/geopandas/test_geopandas_base.py
index de6ab14ad0..821536cd02 100644
--- a/python/tests/geopandas/test_geopandas_base.py
+++ b/python/tests/geopandas/test_geopandas_base.py
@@ -58,7 +58,10 @@ class TestGeopandasBase(TestBase):
         assert isinstance(actual, GeoSeries)
         assert isinstance(expected, gpd.GeoSeries)
         assert actual.name == expected.name, "results are of different names"
-        sgpd_result = actual.to_geopandas()
+        # Sedona's GeoPandas API does not guarantee the row ordering of results,
+        # so align both sides by index before comparing element-wise.
+        sgpd_result = actual.to_geopandas().sort_index()
+        expected = expected.sort_index()
         assert len(sgpd_result) == len(expected), "results are of different lengths"
         for a, e in zip(sgpd_result, expected):
             if a is None or e is None:
@@ -69,7 +72,7 @@ class TestGeopandasBase(TestBase):
                 continue
             cls.assert_geometry_almost_equal(a, e, tolerance)
 
-        assert_index_equal(actual.index.to_pandas(), expected.index)
+        assert_index_equal(sgpd_result.index, expected.index)
 
     @classmethod
     def check_sgpd_df_equals_gpd_df(