Rename cylinder_insulation_thickness to cylinder_insulation_thickness_mm

This commit is contained in:
Daniel Roth 2026-04-21 11:06:21 +00:00
parent 8eb086e3f6
commit b64c9d275f
3 changed files with 22 additions and 14 deletions

View file

@ -20,7 +20,9 @@ from datatypes.epc.domain.epc_property_data import (
from datatypes.epc.domain.mapper import EpcPropertyDataMapper
PDF_PATH = os.path.join(os.path.dirname(__file__), "fixtures", "ExampleSiteNotes.pdf")
PDF_PATH_2 = os.path.join(os.path.dirname(__file__), "fixtures", "ExampleSiteNotes_2.pdf")
PDF_PATH_2 = os.path.join(
os.path.dirname(__file__), "fixtures", "ExampleSiteNotes_2.pdf"
)
class TestPdfToEpcPropertyData:
@ -28,7 +30,9 @@ class TestPdfToEpcPropertyData:
def result(self) -> EpcPropertyData:
with open(PDF_PATH, "rb") as f:
pdf_bytes = f.read()
site_notes = PasHubRdSapSiteNotesExtractor(pdf_to_text_list(pdf_bytes)).extract()
site_notes = PasHubRdSapSiteNotesExtractor(
pdf_to_text_list(pdf_bytes)
).extract()
return EpcPropertyDataMapper.from_site_notes(site_notes)
def test_full_epc_property_data(self, result: EpcPropertyData) -> None:
@ -56,7 +60,9 @@ class TestPdfToEpcPropertyData:
],
has_fixed_air_conditioning=False,
shower_outlets=ShowerOutlets(
shower_outlet=ShowerOutlet(shower_outlet_type="Non-Electric Shower"),
shower_outlet=ShowerOutlet(
shower_outlet_type="Non-Electric Shower"
),
),
),
sap_windows=[
@ -254,8 +260,10 @@ class TestPdfToEpcPropertyDataFixture2:
def result(self) -> EpcPropertyData:
with open(PDF_PATH_2, "rb") as f:
pdf_bytes = f.read()
site_notes = PasHubRdSapSiteNotesExtractor(pdf_to_text_list(pdf_bytes)).extract()
site_notes = PasHubRdSapSiteNotesExtractor(
pdf_to_text_list(pdf_bytes)
).extract()
return EpcPropertyDataMapper.from_site_notes(site_notes)
def test_cylinder_insulation_thickness(self, result: EpcPropertyData) -> None:
assert result.sap_heating.cylinder_insulation_thickness == 38
assert result.sap_heating.cylinder_insulation_thickness_mm == 38

View file

@ -65,7 +65,7 @@ class SapHeating:
cylinder_thermostat: Optional[str] = None
secondary_fuel_type: Optional[int] = None
secondary_heating_type: Optional[int] = None
cylinder_insulation_thickness: Optional[int] = None
cylinder_insulation_thickness_mm: Optional[int] = None
@dataclass

View file

@ -262,7 +262,7 @@ class EpcPropertyDataMapper:
cylinder_thermostat=None,
secondary_fuel_type=None,
secondary_heating_type=None,
cylinder_insulation_thickness=None,
cylinder_insulation_thickness_mm=None,
),
sap_windows=[],
sap_energy_source=SapEnergySource(
@ -403,7 +403,7 @@ class EpcPropertyDataMapper:
cylinder_thermostat=schema.sap_heating.cylinder_thermostat,
secondary_fuel_type=schema.sap_heating.secondary_fuel_type,
secondary_heating_type=schema.sap_heating.secondary_heating_type,
cylinder_insulation_thickness=schema.sap_heating.cylinder_insulation_thickness,
cylinder_insulation_thickness_mm=schema.sap_heating.cylinder_insulation_thickness,
),
sap_windows=[],
sap_energy_source=SapEnergySource(
@ -544,7 +544,7 @@ class EpcPropertyDataMapper:
cylinder_thermostat=schema.sap_heating.cylinder_thermostat,
secondary_fuel_type=schema.sap_heating.secondary_fuel_type,
secondary_heating_type=schema.sap_heating.secondary_heating_type,
cylinder_insulation_thickness=schema.sap_heating.cylinder_insulation_thickness,
cylinder_insulation_thickness_mm=schema.sap_heating.cylinder_insulation_thickness,
),
sap_windows=[],
sap_energy_source=SapEnergySource(
@ -692,7 +692,7 @@ class EpcPropertyDataMapper:
cylinder_thermostat=schema.sap_heating.cylinder_thermostat,
secondary_fuel_type=schema.sap_heating.secondary_fuel_type,
secondary_heating_type=schema.sap_heating.secondary_heating_type,
cylinder_insulation_thickness=schema.sap_heating.cylinder_insulation_thickness,
cylinder_insulation_thickness_mm=schema.sap_heating.cylinder_insulation_thickness,
),
# 19.0 has no per-window list; individual window fields are at schema root
sap_windows=[],
@ -843,7 +843,7 @@ class EpcPropertyDataMapper:
cylinder_thermostat=schema.sap_heating.cylinder_thermostat,
secondary_fuel_type=schema.sap_heating.secondary_fuel_type,
secondary_heating_type=schema.sap_heating.secondary_heating_type,
cylinder_insulation_thickness=schema.sap_heating.cylinder_insulation_thickness,
cylinder_insulation_thickness_mm=schema.sap_heating.cylinder_insulation_thickness,
),
# 20.0.0 SapWindow lacks frame/gap/draught fields present in later schemas
sap_windows=[
@ -1021,7 +1021,7 @@ class EpcPropertyDataMapper:
cylinder_thermostat=schema.sap_heating.cylinder_thermostat,
secondary_fuel_type=schema.sap_heating.secondary_fuel_type,
secondary_heating_type=schema.sap_heating.secondary_heating_type,
cylinder_insulation_thickness=schema.sap_heating.cylinder_insulation_thickness,
cylinder_insulation_thickness_mm=schema.sap_heating.cylinder_insulation_thickness,
),
sap_windows=[
SapWindow(
@ -1254,7 +1254,7 @@ class EpcPropertyDataMapper:
cylinder_thermostat=schema.sap_heating.cylinder_thermostat,
secondary_fuel_type=schema.sap_heating.secondary_fuel_type,
secondary_heating_type=schema.sap_heating.secondary_heating_type,
cylinder_insulation_thickness=schema.sap_heating.cylinder_insulation_thickness,
cylinder_insulation_thickness_mm=schema.sap_heating.cylinder_insulation_thickness,
),
# SAP windows
sap_windows=[
@ -1561,5 +1561,5 @@ def _map_sap_heating(
has_fixed_air_conditioning=ventilation.has_fixed_air_conditioning,
secondary_fuel_type=secondary_fuel_type,
shower_outlets=shower_outlets,
cylinder_insulation_thickness=heating.water_heating.insulation_thickness_mm,
cylinder_insulation_thickness_mm=heating.water_heating.insulation_thickness_mm,
)