Skip to content

add hint to error message #1104

add hint to error message

add hint to error message #1104

GitHub Actions / Core / Unit Test Results (3.10) failed Dec 11, 2024 in 0s

1 fail, 710 pass in 8m 32s

711 tests  ±0   710 ✅  - 1   8m 32s ⏱️ - 2m 19s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     1 ❌ +1 

Results for commit e40c172. ± Comparison against earlier commit c71db3c.

Annotations

Check warning on line 0 in climada.entity.exposures.test.test_base.TestGeoDFFuncs

See this annotation in the file changed.

@github-actions github-actions / Core / Unit Test Results (3.10)

test_latlon_with_polygons (climada.entity.exposures.test.test_base.TestGeoDFFuncs) failed

tests_xml/tests.xml [took 0s]
Raw output
AssertionError: 'Can [65 chars]on, MultiPolygon' != 'Can [65 chars]on, MultiPolygonPlease see the lines_polygons module tutorial.'
- Can only calculate longitude from Points. GeoDataFrame contains Polygon, MultiPolygon
+ Can only calculate longitude from Points. GeoDataFrame contains Polygon, MultiPolygonPlease see the lines_polygons module tutorial.
?                                                                                      ++++++++++++++++++++++++++++++++++++++++++++++
self = <climada.entity.exposures.test.test_base.TestGeoDFFuncs testMethod=test_latlon_with_polygons>

    def test_latlon_with_polygons(self):
        """Check for proper error message if the data frame contains non-Point shapes"""
        poly = Polygon(
            [(10.0, 0.0), (10.0, 1.0), (11.0, 1.0), (11.0, 0.0), (10.0, 0.0)]
        )
        point = Point((1, -1))
        multi = MultiPolygon(
            [
                (
                    ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)),
                    [((0.1, 1.1), (0.1, 1.2), (0.2, 1.2), (0.2, 1.1))],
                )
            ]
        )
        poly = Polygon()
        exp = Exposures(geometry=[poly, point, multi, poly])
        with self.assertRaises(ValueError) as valer:
            exp.latitude
        self.assertEqual(
            "Can only calculate latitude from Points. GeoDataFrame contains Polygon, MultiPolygon",
            str(valer.exception),
        )
        with self.assertRaises(ValueError) as valer:
            exp.longitude
>       self.assertEqual(
            "Can only calculate longitude from Points. GeoDataFrame contains Polygon, MultiPolygon",
            str(valer.exception),
        )
E       AssertionError: 'Can [65 chars]on, MultiPolygon' != 'Can [65 chars]on, MultiPolygonPlease see the lines_polygons module tutorial.'
E       - Can only calculate longitude from Points. GeoDataFrame contains Polygon, MultiPolygon
E       + Can only calculate longitude from Points. GeoDataFrame contains Polygon, MultiPolygonPlease see the lines_polygons module tutorial.
E       ?                                                                                      ++++++++++++++++++++++++++++++++++++++++++++++

climada/entity/exposures/test/test_base.py:679: AssertionError