mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
A goal-aligned scenario without a budget fails loudly 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
3576d05370
commit
102b250e53
1 changed files with 21 additions and 0 deletions
|
|
@ -11,6 +11,8 @@ from __future__ import annotations
|
|||
|
||||
import dataclasses
|
||||
|
||||
import pytest
|
||||
|
||||
from datatypes.epc.domain.epc_property_data import EpcPropertyData
|
||||
from domain.fuel_rates.fuel import Fuel
|
||||
from domain.fuel_rates.fuel_rates import FuelRate, FuelRates
|
||||
|
|
@ -67,6 +69,25 @@ def test_reducing_co2_scenario_buys_carbon_not_sap() -> None:
|
|||
assert MeasureType.GAS_BOILER_UPGRADE not in selected
|
||||
|
||||
|
||||
def test_a_goal_aligned_scenario_without_a_budget_fails_loudly() -> None:
|
||||
# Arrange — 'reduce as much as possible within this budget' is undefined
|
||||
# without a budget: unconstrained it would recommend every beneficial
|
||||
# measure. A budget-less goal-aligned Scenario is a misconfiguration and
|
||||
# must fail visibly, not produce a maximal plan.
|
||||
epc = _solid_brick_dwelling()
|
||||
budgetless = Scenario(
|
||||
id=999,
|
||||
goal="Reducing CO2 emissions",
|
||||
goal_value="",
|
||||
budget=None,
|
||||
is_default=True,
|
||||
)
|
||||
|
||||
# Act / Assert
|
||||
with pytest.raises(ValueError, match="budget"):
|
||||
run_modelling(epc, scenario=budgetless, print_table=False)
|
||||
|
||||
|
||||
class _FixedFuelRates(FuelRatesRepository):
|
||||
def __init__(self, rates: FuelRates) -> None:
|
||||
self._rates = rates
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue