From 2783c2c0c6db320291dcd19023aae3fecb1bc6be Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Tue, 14 Jul 2026 17:18:46 +0000 Subject: [PATCH] =?UTF-8?q?Capture=20PAS=20Hub=20main-heating=20fuel=20fro?= =?UTF-8?q?m=20the=20colon=20'Fuel:'=20label=20variant=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) --- .../documents_parser/tests/test_extractor.py | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/backend/documents_parser/tests/test_extractor.py b/backend/documents_parser/tests/test_extractor.py index be577f1bf..438c8a74d 100644 --- a/backend/documents_parser/tests/test_extractor.py +++ b/backend/documents_parser/tests/test_extractor.py @@ -537,6 +537,44 @@ class TestHeatingAndHotWater: ) +class TestMainHeatingFuelLabelVariant: + """The newer PAS Hub site-note form lodges the main-heating fuel under a + `Fuel:` label (with colon) rather than the usual `Fuel`. The extractor must + recognise both, else the fuel is silently dropped and the property presents + as fuel-less downstream — the 3 Guinness cohort "blank-fuel" residuals that + were really Mains Gas all along (issue #1558).""" + + def _section(self, fuel_label: str) -> list[str]: + return [ + "Heating & Hot Water", + "System type:", + "Boiler with radiators or underfloor heating", + fuel_label, + "Mains Gas", + "Ventilation", + ] + + def test_colon_fuel_label_captures_value(self) -> None: + # Arrange + tokens = self._section("Fuel:") + + # Act + hhw = PasHubRdSapSiteNotesExtractor(tokens).extract_heating_and_hot_water() + + # Assert + assert hhw.main_heating.fuel == "Mains Gas" + + def test_plain_fuel_label_still_captures_value(self) -> None: + # Arrange + tokens = self._section("Fuel") + + # Act + hhw = PasHubRdSapSiteNotesExtractor(tokens).extract_heating_and_hot_water() + + # Assert + assert hhw.main_heating.fuel == "Mains Gas" + + class TestVentilation: @pytest.fixture def ventilation(self) -> Ventilation: