"""First Run end-to-end with NO database, via the harness console entrypoint. `harness.console.run_one` wires the full AraFirstRunPipeline (Ingestion -> Baseline -> Modelling) against in-memory fakes. This proves the whole flow runs start-to-finish with no Session ever opened and yields a multi-measure Plan; `tests/harness/test_console.py` covers the entrypoint's print/return contract. """ from __future__ import annotations import dataclasses from datatypes.epc.domain.epc import Epc from datatypes.epc.domain.epc_property_data import EpcPropertyData from harness.console import run_one from tests.domain.sap10_calculator.worksheet._elmhurst_worksheet_000490 import ( build_epc as _build_uninsulated_cavity_and_floor_epc, ) def _uninsulated_lodged_epc() -> EpcPropertyData: # 000490: an uninsulated cavity wall + suspended floor (loft already 300mm), # so the wall + floor Generators fire and the ventilation Dependency follows. # The calculator fixture carries no lodged recorded-performance, so we fill it # in (it already carries the RHI block) so the Baseline stage can run inside # the full pipeline. epc = _build_uninsulated_cavity_and_floor_epc() return dataclasses.replace( epc, energy_rating_current=57, current_energy_efficiency_band=Epc.D, co2_emissions_current=3.0, energy_consumption_current=300, ) def test_first_run_produces_a_multi_measure_plan_without_a_database() -> None: # Arrange epc: EpcPropertyData = _uninsulated_lodged_epc() # Act — the whole First Run, no Session ever opened. plan = run_one(epc, goal_band="C", print_table=False) # Assert — a multi-measure Plan that improves on the baseline SAP. assert len(plan.measures) >= 1 assert plan.post_sap_continuous >= plan.baseline.sap_continuous