Update test_base.py #1090
GitHub Actions / Core / Unit Test Results (3.11)
failed
Dec 2, 2024 in 0s
1 fail, 710 pass in 10m 39s
Annotations
Check warning on line 0 in climada.entity.exposures.test.test_base.TestGeoDFFuncs
github-actions / Core / Unit Test Results (3.11)
test_latlon_with_polygons (climada.entity.exposures.test.test_base.TestGeoDFFuncs) failed
tests_xml/tests.xml [took 0s]
Raw output
AssertionError: 'Can only calculate latitude from Points. GeoDataFrame contain[19 chars]ygon' != 'Can only calculate longitude from Points. GeoDataFrame contai[20 chars]ygon'
- Can only calculate latitude from Points. GeoDataFrame contains Polygon, MultiPolygon
? ^^
+ Can only calculate longitude from Points. GeoDataFrame contains Polygon, MultiPolygon
? ^^^
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 latitude from Points. GeoDataFrame contains Polygon, MultiPolygon",
str(valer.exception),
)
E AssertionError: 'Can only calculate latitude from Points. GeoDataFrame contain[19 chars]ygon' != 'Can only calculate longitude from Points. GeoDataFrame contai[20 chars]ygon'
E - Can only calculate latitude from Points. GeoDataFrame contains Polygon, MultiPolygon
E ? ^^
E + Can only calculate longitude from Points. GeoDataFrame contains Polygon, MultiPolygon
E ? ^^^
climada/entity/exposures/test/test_base.py:679: AssertionError
Loading