Closed Calychas closed 1 year ago
def test_empty( regions_fixture: str, features_fixture: str, joint_fixture: str, expected_features_fixture: Union[str, None], expectation: Any, request: Any, ) -> None: """Test CountEmbedder handling of empty input data frames.""" expected_output_features = ( None if expected_features_fixture is None else request.getfixturevalue(expected_features_fixture) ) embedder = CountEmbedder(expected_output_features) gdf_regions: gpd.GeoDataFrame = request.getfixturevalue(regions_fixture) gdf_features: gpd.GeoDataFrame = request.getfixturevalue(features_fixture) gdf_joint: gpd.GeoDataFrame = request.getfixturevalue(joint_fixture) with expectation: embedding = embedder.transform(gdf_regions, gdf_features, gdf_joint) assert len(embedding) == len(gdf_regions) > assert_index_equal(embedding.index, gdf_regions.index) tests/embedders/test_count_embedder.py:135: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ left = RangeIndex(start=0, stop=0, step=1, name='region_id'), right = Index([], dtype='object', name='region_id'), obj = 'Index' def _check_types(left, right, obj: str = "Index") -> None: if not exact: return assert_class_equal(left, right, exact=exact, obj=obj) > assert_attr_equal("inferred_type", left, right, obj=obj) E AssertionError: Index are different E E Attribute "inferred_type" are different E [left]: integer E [right]: empty .venv/lib/python3.11/site-packages/pandas/_testing/asserters.py:241: AssertionError
Links to #238
Reason of test breaking - https://pandas.pydata.org/docs/dev/whatsnew/v2.0.0.html#empty-dataframes-series-will-now-default-to-have-a-rangeindex