mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Load BuildingConstruction from SiteNotes JSON 🟥
This commit is contained in:
parent
1db9c68878
commit
101860fac1
1 changed files with 87 additions and 1 deletions
|
|
@ -4,7 +4,14 @@ import os
|
|||
import pytest
|
||||
|
||||
from backend.documents_parser.extractor import PasHubRdSapSiteNotesExtractor
|
||||
from datatypes.epc.surveys.pashub_rdsap_site_notes import General, PasHubRdSapSiteNotes
|
||||
from datatypes.epc.surveys.pashub_rdsap_site_notes import (
|
||||
BuildingConstruction,
|
||||
ExtensionConstruction,
|
||||
FloorConstruction,
|
||||
General,
|
||||
MainBuildingConstruction,
|
||||
PasHubRdSapSiteNotes,
|
||||
)
|
||||
|
||||
FIXTURES = os.path.join(os.path.dirname(__file__), "fixtures")
|
||||
|
||||
|
|
@ -75,3 +82,82 @@ class TestGeneral:
|
|||
gas_meter_accessible=True,
|
||||
measurements_location="Internal",
|
||||
)
|
||||
|
||||
|
||||
class TestBuildingConstruction:
|
||||
@pytest.fixture
|
||||
def construction(self) -> BuildingConstruction:
|
||||
return PasHubRdSapSiteNotesExtractor(
|
||||
load_text_fixture()
|
||||
).extract_building_construction()
|
||||
|
||||
def test_main_building_wall_u_value_known_is_false(
|
||||
self, construction: BuildingConstruction
|
||||
) -> None:
|
||||
assert construction.main_building.wall_u_value_known is False
|
||||
|
||||
def test_main_building_wall_thickness_mm(
|
||||
self, construction: BuildingConstruction
|
||||
) -> None:
|
||||
assert construction.main_building.wall_thickness_mm == 310
|
||||
|
||||
def test_main_building_filled_cavity_indicators_present(
|
||||
self, construction: BuildingConstruction
|
||||
) -> None:
|
||||
assert (
|
||||
construction.main_building.filled_cavity_indicators
|
||||
== "evidence of cavity fill drill holes"
|
||||
)
|
||||
|
||||
def test_extension_filled_cavity_indicators_absent(
|
||||
self, construction: BuildingConstruction
|
||||
) -> None:
|
||||
assert construction.extensions is not None
|
||||
assert construction.extensions[0].filled_cavity_indicators is None
|
||||
|
||||
def test_one_extension(self, construction: BuildingConstruction) -> None:
|
||||
assert construction.extensions is not None
|
||||
assert len(construction.extensions) == 1
|
||||
|
||||
def test_extension_id(self, construction: BuildingConstruction) -> None:
|
||||
assert construction.extensions is not None
|
||||
assert construction.extensions[0].id == 1
|
||||
|
||||
def test_full_building_construction(
|
||||
self, construction: BuildingConstruction
|
||||
) -> None:
|
||||
assert construction == BuildingConstruction(
|
||||
main_building=MainBuildingConstruction(
|
||||
age_range="1950-1966",
|
||||
age_indicators="local knowledge, enquiries of owner",
|
||||
walls_construction_type="Cavity",
|
||||
cavity_construction_indicators="wall thickness over 270 mm",
|
||||
walls_insulation_type="Filled Cavity",
|
||||
filled_cavity_indicators="evidence of cavity fill drill holes",
|
||||
thermal_conductivity_of_wall_insulation="Unknown",
|
||||
wall_u_value_known=False,
|
||||
wall_thickness_mm=310,
|
||||
party_wall_construction_type="Cavity Masonry, Filled",
|
||||
),
|
||||
floor=FloorConstruction(
|
||||
floor_type="Ground Floor",
|
||||
floor_construction="Solid",
|
||||
floor_insulation_type="As Built",
|
||||
floor_u_value_known=False,
|
||||
),
|
||||
extensions=[
|
||||
ExtensionConstruction(
|
||||
id=1,
|
||||
age_range="2003-2006",
|
||||
age_indicators="local knowledge, enquiries of owner",
|
||||
walls_construction_type="Cavity",
|
||||
cavity_construction_indicators="wall thickness over 270 mm",
|
||||
walls_insulation_type="As built",
|
||||
thermal_conductivity_of_wall_insulation="Unknown",
|
||||
wall_u_value_known=False,
|
||||
wall_thickness_mm=310,
|
||||
party_wall_construction_type="Cavity Masonry, Filled",
|
||||
filled_cavity_indicators=None,
|
||||
)
|
||||
],
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue