mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-11 08:23:48 -04:00
Add tests to ensure all areas have a count
This commit is contained in:
@@ -23,11 +23,11 @@ for min, max in SMARTPHONE_OWNERSHIP_BY_AGE_RANGE.keys():
|
||||
|
||||
class CITY_OF_LONDON:
|
||||
WARDS = (
|
||||
'E05009289', 'E05009290', 'E05009291', 'E05009292', 'E05009293',
|
||||
'E05009294', 'E05009295', 'E05009296', 'E05009297', 'E05009298',
|
||||
'E05009299', 'E05009300', 'E05009301', 'E05009302', 'E05009303',
|
||||
'E05009304', 'E05009305', 'E05009306', 'E05009307', 'E05009308',
|
||||
'E05009309', 'E05009310', 'E05009311', 'E05009312',
|
||||
'E05009288', 'E05009289', 'E05009290', 'E05009291', 'E05009292',
|
||||
'E05009293', 'E05009294', 'E05009295', 'E05009296', 'E05009297',
|
||||
'E05009298', 'E05009299', 'E05009300', 'E05009301', 'E05009302',
|
||||
'E05009303', 'E05009304', 'E05009305', 'E05009306', 'E05009307',
|
||||
'E05009308', 'E05009309', 'E05009310', 'E05009311', 'E05009312',
|
||||
)
|
||||
# https://data.london.gov.uk/blog/daytime-population-of-london-2014/
|
||||
DAYTIME_POPULATION = 553_000
|
||||
|
||||
@@ -4,6 +4,7 @@ from app.broadcast_areas import (
|
||||
BroadcastAreasRepository,
|
||||
broadcast_area_libraries,
|
||||
)
|
||||
from app.broadcast_areas.constants import CITY_OF_LONDON
|
||||
|
||||
|
||||
def test_loads_libraries():
|
||||
@@ -147,3 +148,31 @@ def test_repository_has_all_libraries():
|
||||
('Countries', 'country'),
|
||||
('Local authorities', 'local authority'),
|
||||
] == [(name, name_singular) for _, name, name_singular, _is_group in libraries]
|
||||
|
||||
|
||||
@pytest.mark.parametrize('library', (
|
||||
broadcast_area_libraries
|
||||
))
|
||||
def test_every_area_has_count_of_phones(library):
|
||||
for area in library:
|
||||
assert area.count_of_phones > 0
|
||||
|
||||
|
||||
def test_bryher_has_hard_coded_count():
|
||||
bryher = broadcast_area_libraries.get_areas('wd20-E05011090')[0]
|
||||
assert bryher.name == 'Bryher'
|
||||
assert bryher.count_of_phones == 76.44
|
||||
|
||||
|
||||
def test_city_of_london_counts_are_not_derived_from():
|
||||
city_of_london = broadcast_area_libraries.get_areas('lad20-E09000001')[0]
|
||||
|
||||
assert city_of_london.name == 'City of London'
|
||||
assert len(city_of_london.sub_areas) == len(CITY_OF_LONDON.WARDS) == 25
|
||||
|
||||
for ward in city_of_london.sub_areas:
|
||||
# The population of the whole City of London is 9,401, so an
|
||||
# average of 300 per ward. What we’re asserting here is that the
|
||||
# count of phones is much larger, because it isn’t derived from
|
||||
# the resident population.
|
||||
assert ward.count_of_phones > 5_000
|
||||
|
||||
Reference in New Issue
Block a user