diff --git a/datatypes/epc/domain/tests/test_from_rdsap_schema.py b/datatypes/epc/domain/tests/test_from_rdsap_schema.py index 3ff99b4e..f5077eac 100644 --- a/datatypes/epc/domain/tests/test_from_rdsap_schema.py +++ b/datatypes/epc/domain/tests/test_from_rdsap_schema.py @@ -1605,3 +1605,35 @@ class TestRdSap18_0ReducedFieldSynthesis: # Assert — every synthesised window has an int glazing_type, not "ND". assert result.sap_windows assert all(isinstance(w.glazing_type, int) for w in result.sap_windows) + + def test_lighting_counts_incandescent_remainder_and_low_energy_as_lel( + self, + ) -> None: + # Arrange — ADR-0028: 18.0 gives total + low-energy OUTLET counts, not an + # LED/CFL/incandescent split (matches 20.0.0). The non-low-energy + # remainder is incandescent (else lighting energy is understated); the + # low-energy outlets feed the calculator's LEL path. A cert with some + # incandescent (non-low-energy) outlets. + corpus = _load_18_0_corpus() + if not corpus: + pytest.skip("no RdSAP-Schema-18.0 corpus harvested") + cert = next( + ( + c + for c in corpus + if (c.get("fixed_lighting_outlets_count") or 0) + > (c.get("low_energy_fixed_lighting_outlets_count") or 0) + ), + None, + ) + if cert is None: + pytest.skip("no corpus cert with incandescent lighting") + total = cert["fixed_lighting_outlets_count"] + low = cert["low_energy_fixed_lighting_outlets_count"] + + # Act + result = EpcPropertyDataMapper.from_api_response(cert) + + # Assert + assert result.incandescent_fixed_lighting_bulbs_count == total - low + assert result.low_energy_fixed_lighting_bulbs_count == low