mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-04 05:20:46 -04:00
Brings in https://github.com/alphagov/notifications-utils/pull/889/files At the moment, we are not doing any transformation of features before applying geometric algorithms to them. This is, in effect, assuming that the earth is flat. This new version of utils implements the transformation of our polygons to a Cartesian plane. In other words, it converts them from being defined in spherical degrees to metres. For the admin app this means we need to convert places where the code expects things to be measured in degrees to work in metres instead.
21 lines
590 B
Python
21 lines
590 B
Python
import pytest
|
|
|
|
from app.broadcast_areas.models import CustomBroadcastArea
|
|
from tests.app.broadcast_areas.custom_polygons import BRISTOL, SANTA_A, SKYE
|
|
|
|
|
|
@pytest.mark.parametrize(('simple_polygon', 'expected_wards_length'), [
|
|
(SKYE, 1),
|
|
(BRISTOL, 12),
|
|
(SANTA_A, 0) # does not overlap with UK
|
|
])
|
|
def test_custom_broadcast_area_overlapping_electoral_wards(
|
|
simple_polygon,
|
|
expected_wards_length,
|
|
):
|
|
custom_area = CustomBroadcastArea(
|
|
name='foo', polygons=[simple_polygon]
|
|
)
|
|
|
|
assert len(custom_area.overlapping_electoral_wards) == expected_wards_length
|