perfect-postcode/pipeline/download/test_pois.py
2026-05-14 08:09:19 +01:00

15 lines
451 B
Python

from shapely.geometry import Polygon, box
from pipeline.download.pois import _representative_lat_lon
def test_representative_lat_lon_uses_point_inside_polygon():
england = box(-1, 50, 1, 52)
poi_area = Polygon([(-0.1, 51.5), (0.1, 51.5), (0.1, 51.6), (-0.1, 51.6)])
lat_lon = _representative_lat_lon(poi_area, england)
assert lat_lon is not None
lat, lon = lat_lon
assert 51.5 <= lat <= 51.6
assert -0.1 <= lon <= 0.1