From 70af9dee65ae0363ca23d550f32aad80f3b5d077 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Thu, 11 Jun 2026 11:59:33 +0000 Subject: [PATCH] =?UTF-8?q?Synthesise=20lighting=20bulb=20counts=20from=20?= =?UTF-8?q?outlet=20counts=20for=2018.0=20certs=20=F0=9F=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- .../domain/tests/test_from_rdsap_schema.py | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) 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