mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-27 23:35:01 +00:00
Guarantee every measure column on every scenario sheet 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c4e1cc4229
commit
04be6b57a2
1 changed files with 21 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ Property, and the Plan's post-works figures."""
|
|||
from typing import Optional, Sequence
|
||||
|
||||
from domain.scenario_export.scenario_sheet import (
|
||||
MEASURE_COLUMNS,
|
||||
ExportMeasure,
|
||||
PropertyScenarioData,
|
||||
shape_scenario_sheet,
|
||||
|
|
@ -65,3 +66,23 @@ def test_a_measures_cost_lands_in_its_own_column_with_the_property_identity() ->
|
|||
assert row["property_id"] == 42
|
||||
assert row["landlord_property_id"] == "LP42"
|
||||
assert row["loft_insulation"] == 1200.0
|
||||
|
||||
|
||||
def test_every_measure_column_is_present_and_blank_where_the_property_lacks_it() -> None:
|
||||
# arrange — a Property with a single measure. Every other measure column
|
||||
# must still appear on the sheet (the frozen contract, ADR-0065), blank for
|
||||
# this Property, so all scenario sheets share one column set.
|
||||
prop = _property(
|
||||
measures=[_measure(measure_type="cavity_wall_insulation", estimated_cost=800.0)]
|
||||
)
|
||||
|
||||
# act
|
||||
sheet = shape_scenario_sheet([prop])
|
||||
|
||||
# assert — the full frozen measure contract is present; the one selected
|
||||
# measure carries its cost, every other measure column is blank.
|
||||
assert set(MEASURE_COLUMNS).issubset(set(sheet.columns))
|
||||
row = sheet.rows[0]
|
||||
assert row["cavity_wall_insulation"] == 800.0
|
||||
assert row["loft_insulation"] == ""
|
||||
assert row["solar_pv"] == ""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue