diff --git a/germany_beer_map/tests/test_algoritms.py b/germany_beer_map/tests/test_algoritms.py index 9a58ddd..9d96d26 100644 --- a/germany_beer_map/tests/test_algoritms.py +++ b/germany_beer_map/tests/test_algoritms.py @@ -29,4 +29,14 @@ def test_calculate_mse(): contour1 = np.array([[1, 1], [2, 2]]) contour2 = np.array([[3, 3], [4, 4]]) expected = 4.0 - assert calculate_mse(contour1, contour2) == expected \ No newline at end of file + assert calculate_mse(contour1, contour2) == expected + +def test_geocode(): + # Test with a single address, Plenarbereich Reichstagsgebäude. + # Of known coordinates: 51.5186111, 13.3761111 (52°31′07″N 13°22′34″E) + address = "Platz der Republik 1, 11011 Berlin, Germany" + expected = (13.376296140954109, 52.518671200312156) + result = tuple(convert_address_to_coords(address=address)[-1]) + print("result: ", *result, "expected: ", *expected) + # Check if the distance is within 50 meters + assert haversine(*expected, *result) * 1000 <= 50 \ No newline at end of file