lgtm
This commit is contained in:
parent
a08b5d2ae0
commit
b98f0e3904
38 changed files with 3732 additions and 483 deletions
|
|
@ -101,6 +101,33 @@ def test_custom_radius(pois):
|
|||
assert total <= 2 # at most the co-located POIs
|
||||
|
||||
|
||||
def test_counts_pois_across_multiple_grid_cells_within_5km():
|
||||
"""A POI around 4.8km away must not be dropped by grid candidate lookup."""
|
||||
postcodes = pl.DataFrame(
|
||||
{
|
||||
"postcode": ["GRID 5KM"],
|
||||
"lat": [51.5],
|
||||
"lon": [0.049],
|
||||
}
|
||||
)
|
||||
pois = pl.DataFrame(
|
||||
{
|
||||
"lat": [51.5, 51.5],
|
||||
"lng": [0.1183, 0.1240],
|
||||
"category": ["Park", "Park"],
|
||||
}
|
||||
)
|
||||
|
||||
result = count_pois_per_postcode(
|
||||
postcodes,
|
||||
pois,
|
||||
groups={"parks": ["Park"]},
|
||||
radius_km=5.0,
|
||||
)
|
||||
|
||||
assert result["parks_5km"][0] == 1
|
||||
|
||||
|
||||
def test_min_distance_finds_nearest(postcodes, pois):
|
||||
"""min_distance_per_postcode returns distance to closest POI per group."""
|
||||
result = min_distance_per_postcode(postcodes, pois, groups=POI_GROUPS)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue