Skip to content

Commit

Permalink
Add test for geocoding algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-jakob committed Jan 21, 2024
1 parent abfb484 commit 2596ea7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion germany_beer_map/tests/test_algoritms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
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

0 comments on commit 2596ea7

Please sign in to comment.