diff --git a/domain/sap10_calculator/rdsap/tests/test_cert_to_inputs.py b/domain/sap10_calculator/rdsap/tests/test_cert_to_inputs.py index 0c9a0e75..381a6636 100644 --- a/domain/sap10_calculator/rdsap/tests/test_cert_to_inputs.py +++ b/domain/sap10_calculator/rdsap/tests/test_cert_to_inputs.py @@ -334,7 +334,11 @@ def test_no_ac_cert_round_trips_fee_equals_space_heating_per_m2() -> None: """For an RdSAP cert without fixed AC, (108) = 0, so SAP 10.2 (109) Fabric Energy Efficiency = (Σ(98a) / TFA) + 0 = annual space heating per m². No Appendix H solar space heating means Σ(98a) == Σ(98c), so the FEE matches - `space_heating_kwh_per_yr / TFA` to float-equality.""" + `space_heating_kwh_per_yr / TFA` modulo small float-arithmetic drift — + the two paths sum 12 monthlies in different orders / rounding-step + sequences, so they disagree at ~1e-7. 1e-6 is loose enough to absorb + that drift, tight enough that any meaningful path divergence (e.g. a + 4-d.p. lodgement step or stray AC contribution) blows past instantly.""" # Arrange epc = _typical_semi_detached_epc() assert epc.sap_heating.has_fixed_air_conditioning is False @@ -346,9 +350,7 @@ def test_no_ac_cert_round_trips_fee_equals_space_heating_per_m2() -> None: expected_fee = ( result.space_heating_kwh_per_yr / result.intermediate["tfa_m2"] ) - assert result.fabric_energy_efficiency_kwh_per_m2_yr == pytest.approx( - expected_fee, abs=1e-9 - ) + assert abs(result.fabric_energy_efficiency_kwh_per_m2_yr - expected_fee) <= 1e-6 assert result.space_cooling_kwh_per_yr == 0.0