mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
Route age-band overrides to the right part, normalise, reject unknown 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
406365753b
commit
cd14751fdb
1 changed files with 37 additions and 0 deletions
|
|
@ -7,6 +7,8 @@ the override's building part.
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from datatypes.epc.domain.epc_property_data import BuildingPartIdentifier
|
||||
from domain.epc.property_overlays.construction_age_band_overlay import (
|
||||
age_band_overlay_for,
|
||||
|
|
@ -21,3 +23,38 @@ def test_age_band_overlays_the_main_building_part() -> None:
|
|||
assert simulation is not None
|
||||
overlay = simulation.building_parts[BuildingPartIdentifier.MAIN]
|
||||
assert overlay.construction_age_band == "B"
|
||||
|
||||
|
||||
def test_age_band_overlay_targets_the_extension_building_part() -> None:
|
||||
# Act — building_part 1 is the first extension.
|
||||
simulation = age_band_overlay_for("L", 1)
|
||||
|
||||
# Assert
|
||||
assert simulation is not None
|
||||
assert BuildingPartIdentifier.EXTENSION_1 in simulation.building_parts
|
||||
assert (
|
||||
simulation.building_parts[BuildingPartIdentifier.EXTENSION_1]
|
||||
.construction_age_band
|
||||
== "L"
|
||||
)
|
||||
|
||||
|
||||
def test_lowercase_age_band_is_normalised_to_its_letter_code() -> None:
|
||||
# Act
|
||||
simulation = age_band_overlay_for("d", 0)
|
||||
|
||||
# Assert — the calculator upper-cases the band; the overlay stores it upper.
|
||||
assert simulation is not None
|
||||
assert (
|
||||
simulation.building_parts[BuildingPartIdentifier.MAIN].construction_age_band
|
||||
== "D"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("age_band_value", ["Z", "", "1900-1929", "Unknown"])
|
||||
def test_unrecognised_age_band_produces_no_overlay(age_band_value: str) -> None:
|
||||
# Act
|
||||
simulation = age_band_overlay_for(age_band_value, 0)
|
||||
|
||||
# Assert
|
||||
assert simulation is None
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue