extract water heating cylinder thickness alternative field name 🟩

This commit is contained in:
Daniel Roth 2026-04-21 10:45:56 +00:00
parent ac854f161a
commit 6b4a8dfef1
2 changed files with 12 additions and 2 deletions

View file

@ -573,7 +573,8 @@ class PasHubRdSapSiteNotesExtractor:
)
def _parse_water_heating(self, data: List[str]) -> WaterHeating:
thickness_raw = self._get_in(data, "Insulation Thickness (mm):")
thickness_raw = self._get_in(data, "Insulation Thickness (mm):") or self._get_in(data, "Thickness:")
thickness_mm = int(thickness_raw.split()[0]) if thickness_raw else None
return WaterHeating(
type=self._get_in(data, "Water Heating Type:") or "",
system=self._get_in(data, "Water Heating System:") or "",
@ -582,7 +583,7 @@ class PasHubRdSapSiteNotesExtractor:
data, "Cylinder Measured Heat Loss:"
),
insulation_type=self._get_in(data, "Insulation Type:"),
insulation_thickness_mm=int(thickness_raw) if thickness_raw else None,
insulation_thickness_mm=thickness_mm,
has_thermostat=self._optional_bool_in(data, "Cylinder Thermostat:"),
)

View file

@ -377,9 +377,18 @@ class TestWaterHeatingCylinderThickness:
load_text_fixture_2()
).extract_heating_and_hot_water()
@pytest.fixture
def hhw_no_cylinder(self) -> HeatingAndHotWater:
return PasHubRdSapSiteNotesExtractor(
load_text_fixture()
).extract_heating_and_hot_water()
def test_cylinder_insulation_thickness_mm(self, hhw: HeatingAndHotWater) -> None:
assert hhw.water_heating.insulation_thickness_mm == 38
def test_cylinder_insulation_thickness_mm_absent(self, hhw_no_cylinder: HeatingAndHotWater) -> None:
assert hhw_no_cylinder.water_heating.insulation_thickness_mm is None
class TestHeatingAndHotWater:
@pytest.fixture