From f758216bf19c78ad5450294842e78c75e77dd69b Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Mon, 13 Jul 2026 23:12:51 +0000 Subject: [PATCH] =?UTF-8?q?Pivot=20solar=20PV=20with=20a=20battery=20to=20?= =?UTF-8?q?its=20own=20column=20=F0=9F=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- .../scenario_export/test_scenario_sheet.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/domain/scenario_export/test_scenario_sheet.py b/tests/domain/scenario_export/test_scenario_sheet.py index e21e633a2..54d35e37e 100644 --- a/tests/domain/scenario_export/test_scenario_sheet.py +++ b/tests/domain/scenario_export/test_scenario_sheet.py @@ -142,3 +142,26 @@ def test_total_retrofit_cost_sums_the_per_measure_costs() -> None: # assert — the package total is the sum of the measure costs. assert sheet.rows[0]["total_retrofit_cost"] == 2000.0 + + +def test_solar_pv_with_a_battery_pivots_to_its_own_battery_column() -> None: + # arrange — a solar_pv Option that includes a battery. + prop = _property( + measures=[ + _measure( + measure_type="solar_pv", estimated_cost=6000.0, includes_battery=True + ) + ] + ) + + # act + sheet = shape_scenario_sheet([prop]) + + # assert — the cost lands in the battery variant column (a stable part of the + # contract), the plain solar_pv column stays blank, and the total still + # counts it. + assert "solar_pv_with_battery" in sheet.columns + row = sheet.rows[0] + assert row["solar_pv_with_battery"] == 6000.0 + assert row["solar_pv"] == "" + assert row["total_retrofit_cost"] == 6000.0