from __future__ import annotations from datatypes.epc.domain.epc import Epc from datatypes.epc.domain.epc_property_data import EpcPropertyData from domain.property_baseline.performance import Performance, lodged_performance def _epc_with_recorded_performance( *, sap: int, band: Epc, co2: float, peui: int ) -> EpcPropertyData: # A bare instance with only the recorded-performance fields the reader # touches — mirrors the opaque-EPC idiom used in the ingestion tests. epc = object.__new__(EpcPropertyData) epc.energy_rating_current = sap epc.current_energy_efficiency_band = band epc.co2_emissions_current = co2 epc.energy_consumption_current = peui return epc def test_lodged_performance_reads_the_four_recorded_quantities_off_the_epc() -> None: # Arrange epc = _epc_with_recorded_performance(sap=72, band=Epc.C, co2=1.8, peui=180) # Act performance = lodged_performance(epc) # Assert assert performance == Performance( sap_score=72, epc_band=Epc.C, co2_emissions=1.8, primary_energy_intensity=180, )