Model/tests/domain/epc/test_attribute_overlay.py
Jun-te Kim 4219ef9d8b Overlay landlord property-type and built-form corrections onto the Effective EPC 🟩
Adds whole-dwelling property_type/built_form to EpcSimulation (folded by
apply_simulations) and maps those override components. property_type drives
party-wall heat loss + ASHP/solar/wall eligibility, so a landlord correction now
moves both the SAP calc and the measure menu; built_form has no calculator
consumer today (feeds the ML transform). Written as the landlord text value
(park-home check is text-only). Refines ADR-0032 dec-4.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 18:06:29 +00:00

44 lines
1.2 KiB
Python

"""Landlord property-type / built-form → whole-dwelling Simulation Overlay (ADR-0032).
The landlord value is written as-is onto the top-level EpcSimulation fields;
"Unknown" resolves to no overlay.
"""
from __future__ import annotations
import pytest
from domain.epc.attribute_overlay import (
built_form_overlay_for,
property_type_overlay_for,
)
def test_property_type_override_sets_the_whole_dwelling_property_type() -> None:
# Act
simulation = property_type_overlay_for("House", 0)
# Assert
assert simulation is not None
assert simulation.property_type == "House"
def test_built_form_override_sets_the_whole_dwelling_built_form() -> None:
# Act
simulation = built_form_overlay_for("Semi-Detached", 0)
# Assert
assert simulation is not None
assert simulation.built_form == "Semi-Detached"
@pytest.mark.parametrize("value", ["Unknown", ""])
def test_unknown_property_type_produces_no_overlay(value: str) -> None:
# Act / Assert
assert property_type_overlay_for(value, 0) is None
@pytest.mark.parametrize("value", ["Unknown", ""])
def test_unknown_built_form_produces_no_overlay(value: str) -> None:
# Act / Assert
assert built_form_overlay_for(value, 0) is None