mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
additional fields mapped from pdf 5 🟩
This commit is contained in:
parent
e272a39380
commit
2bf8bc6d5e
4 changed files with 80 additions and 0 deletions
BIN
backend/documents_parser/tests/fixtures/ExampleSiteNotes_5.pdf
vendored
Normal file
BIN
backend/documents_parser/tests/fixtures/ExampleSiteNotes_5.pdf
vendored
Normal file
Binary file not shown.
1
backend/documents_parser/tests/fixtures/site_notes_example_5_text.json
vendored
Normal file
1
backend/documents_parser/tests/fixtures/site_notes_example_5_text.json
vendored
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -340,3 +340,35 @@ class TestPdfToEpcPropertyDataFixture4:
|
|||
|
||||
def test_roof_insulation_thickness_none(self, result: EpcPropertyData) -> None:
|
||||
assert result.sap_building_parts[0].roof_insulation_thickness is None
|
||||
|
||||
|
||||
PDF_PATH_5 = os.path.join(
|
||||
os.path.dirname(__file__), "fixtures", "ExampleSiteNotes_5.pdf"
|
||||
)
|
||||
|
||||
|
||||
class TestPdfToEpcPropertyDataFixture5:
|
||||
@pytest.fixture
|
||||
def result(self) -> EpcPropertyData:
|
||||
with open(PDF_PATH_5, "rb") as f:
|
||||
pdf_bytes = f.read()
|
||||
site_notes = PasHubRdSapSiteNotesExtractor(
|
||||
pdf_to_text_list(pdf_bytes)
|
||||
).extract()
|
||||
return EpcPropertyDataMapper.from_site_notes(site_notes)
|
||||
|
||||
def test_cfl_bulb_count(self, result: EpcPropertyData) -> None:
|
||||
assert result.cfl_fixed_lighting_bulbs_count == 2
|
||||
|
||||
def test_secondary_heating_type(self, result: EpcPropertyData) -> None:
|
||||
assert (
|
||||
result.sap_heating.secondary_heating_type
|
||||
== "Panel, convector or radiant heaters"
|
||||
)
|
||||
|
||||
def test_electric_shower_outlet_type(self, result: EpcPropertyData) -> None:
|
||||
assert result.sap_heating.shower_outlets is not None
|
||||
assert (
|
||||
result.sap_heating.shower_outlets.shower_outlet.shower_outlet_type
|
||||
== "Electric Shower"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -56,6 +56,11 @@ def load_text_fixture_4() -> list[str]:
|
|||
return json.load(f)
|
||||
|
||||
|
||||
def load_text_fixture_5() -> list[str]:
|
||||
with open(os.path.join(FIXTURES, "site_notes_example_5_text.json")) as f:
|
||||
return json.load(f)
|
||||
|
||||
|
||||
class TestInspectionMetadata:
|
||||
def test_full_inspection_metadata(self) -> None:
|
||||
result = PasHubRdSapSiteNotesExtractor(load_text_fixture()).extract_inspection_metadata()
|
||||
|
|
@ -731,3 +736,45 @@ class TestRoofSpaceUnknownInsulation:
|
|||
|
||||
def test_insulation_thickness_str_none(self, roof_space: RoofSpace) -> None:
|
||||
assert roof_space.main_building.insulation_thickness is None
|
||||
|
||||
|
||||
class TestCflBulbCount:
|
||||
@pytest.fixture
|
||||
def rce(self) -> RoomCountElements:
|
||||
return PasHubRdSapSiteNotesExtractor(
|
||||
load_text_fixture_5()
|
||||
).extract_room_count_elements()
|
||||
|
||||
def test_cfl_count(self, rce: RoomCountElements) -> None:
|
||||
assert rce.number_of_fixed_cfl_bulbs == 2
|
||||
|
||||
def test_led_count(self, rce: RoomCountElements) -> None:
|
||||
assert rce.number_of_fixed_led_bulbs == 7
|
||||
|
||||
def test_incandescent_count(self, rce: RoomCountElements) -> None:
|
||||
assert rce.number_of_fixed_incandescent_bulbs == 1
|
||||
|
||||
|
||||
class TestSecondaryHeatingPanel:
|
||||
@pytest.fixture
|
||||
def hhw(self) -> HeatingAndHotWater:
|
||||
return PasHubRdSapSiteNotesExtractor(
|
||||
load_text_fixture_5()
|
||||
).extract_heating_and_hot_water()
|
||||
|
||||
def test_secondary_system(self, hhw: HeatingAndHotWater) -> None:
|
||||
assert hhw.secondary_heating.secondary_system == "Panel, convector or radiant heaters"
|
||||
|
||||
def test_secondary_fuel(self, hhw: HeatingAndHotWater) -> None:
|
||||
assert hhw.secondary_heating.secondary_fuel == "Electricity"
|
||||
|
||||
|
||||
class TestElectricShowerExtraction:
|
||||
@pytest.fixture
|
||||
def wu(self) -> WaterUse:
|
||||
return PasHubRdSapSiteNotesExtractor(
|
||||
load_text_fixture_5()
|
||||
).extract_water_use()
|
||||
|
||||
def test_shower_outlet_type(self, wu: WaterUse) -> None:
|
||||
assert wu.showers[0].outlet_type == "Electric Shower"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue