mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
Guarantee every classifier age-band value maps to an overlay 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
cb6a335382
commit
46d1f8bbb2
1 changed files with 25 additions and 2 deletions
|
|
@ -9,7 +9,12 @@ from __future__ import annotations
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from datatypes.epc.domain.epc_property_data import BuildingPartIdentifier
|
from datatypes.epc.domain.epc_property_data import (
|
||||||
|
BuildingPartIdentifier,
|
||||||
|
EpcPropertyData,
|
||||||
|
SapBuildingPart,
|
||||||
|
)
|
||||||
|
from domain.epc.construction_age_band import ConstructionAgeBand
|
||||||
from domain.epc.property_overlays.construction_age_band_overlay import (
|
from domain.epc.property_overlays.construction_age_band_overlay import (
|
||||||
age_band_overlay_for,
|
age_band_overlay_for,
|
||||||
)
|
)
|
||||||
|
|
@ -19,7 +24,9 @@ from tests.domain.sap10_calculator.worksheet._elmhurst_worksheet_000490 import (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def _part(epc, identifier): # type: ignore[no-untyped-def]
|
def _part(
|
||||||
|
epc: EpcPropertyData, identifier: BuildingPartIdentifier
|
||||||
|
) -> SapBuildingPart:
|
||||||
return next(p for p in epc.sap_building_parts if p.identifier is identifier)
|
return next(p for p in epc.sap_building_parts if p.identifier is identifier)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -84,3 +91,19 @@ def test_age_band_override_re_dates_the_main_part_only() -> None:
|
||||||
assert (
|
assert (
|
||||||
_part(result, BuildingPartIdentifier.EXTENSION_1).construction_age_band == "B"
|
_part(result, BuildingPartIdentifier.EXTENSION_1).construction_age_band == "B"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"member", [m for m in ConstructionAgeBand if m is not ConstructionAgeBand.UNKNOWN]
|
||||||
|
)
|
||||||
|
def test_every_resolvable_age_band_value_decodes_to_an_overlay(
|
||||||
|
member: ConstructionAgeBand,
|
||||||
|
) -> None:
|
||||||
|
# A classifier emits a ConstructionAgeBand value; if the overlay can't decode
|
||||||
|
# it the override silently no-ops. Every non-UNKNOWN member must resolve.
|
||||||
|
|
||||||
|
# Act
|
||||||
|
simulation = age_band_overlay_for(member.value, 0)
|
||||||
|
|
||||||
|
# Assert
|
||||||
|
assert simulation is not None
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue