mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
load historic epc from csv 🟥
This commit is contained in:
parent
90a4d83243
commit
74b7b87de6
4 changed files with 67 additions and 0 deletions
0
datatypes/epc/loaders/__init__.py
Normal file
0
datatypes/epc/loaders/__init__.py
Normal file
5
datatypes/epc/loaders/historic_epc.py
Normal file
5
datatypes/epc/loaders/historic_epc.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
from datatypes.epc.schema.historic_epc import HistoricEpc
|
||||
|
||||
|
||||
def read_historic_epc_csv(path: str) -> list[HistoricEpc]:
|
||||
raise NotImplementedError("read_historic_epc_csv not implemented yet")
|
||||
|
|
@ -95,3 +95,10 @@ class HistoricEpc:
|
|||
low_energy_fixed_light_count: str
|
||||
uprn: str
|
||||
uprn_source: str
|
||||
report_type: str
|
||||
improvement_item: str
|
||||
improvement_summary_text: str
|
||||
improvement_descr_text: str
|
||||
improvement_id: str
|
||||
improvement_id_text: str
|
||||
indicative_cost: str
|
||||
|
|
|
|||
55
datatypes/epc/schema/tests/test_historic_epc_loading.py
Normal file
55
datatypes/epc/schema/tests/test_historic_epc_loading.py
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
from datatypes.epc.loaders.historic_epc import read_historic_epc_csv
|
||||
from datatypes.epc.schema.historic_epc import HistoricEpc
|
||||
|
||||
FIXTURES = os.path.join(os.path.dirname(__file__), "fixtures")
|
||||
|
||||
|
||||
class TestHistoricEpcLoading:
|
||||
|
||||
@pytest.fixture
|
||||
def epc(self) -> HistoricEpc:
|
||||
rows = read_historic_epc_csv(os.path.join(FIXTURES, "historic_epc.csv"))
|
||||
return rows[0]
|
||||
|
||||
def test_returns_historic_epc_instance(self, epc: HistoricEpc) -> None:
|
||||
assert isinstance(epc, HistoricEpc)
|
||||
|
||||
def test_lmk_key(self, epc: HistoricEpc) -> None:
|
||||
assert epc.lmk_key == "9292c3bf26a8876ce59274401ea73e3de5bd0b3e52a507c2162a46e57db8ea2f"
|
||||
|
||||
def test_address1(self, epc: HistoricEpc) -> None:
|
||||
assert epc.address1 == "47 GORDON ROAD"
|
||||
|
||||
def test_postcode(self, epc: HistoricEpc) -> None:
|
||||
assert epc.postcode == "AB33 8AL"
|
||||
|
||||
def test_current_energy_rating(self, epc: HistoricEpc) -> None:
|
||||
assert epc.current_energy_rating == "E"
|
||||
|
||||
def test_property_type(self, epc: HistoricEpc) -> None:
|
||||
assert epc.property_type == "House"
|
||||
|
||||
def test_built_form(self, epc: HistoricEpc) -> None:
|
||||
assert epc.built_form == "Semi-Detached"
|
||||
|
||||
def test_inspection_date(self, epc: HistoricEpc) -> None:
|
||||
assert epc.inspection_date == "2021-04-11"
|
||||
|
||||
def test_uprn(self, epc: HistoricEpc) -> None:
|
||||
assert epc.uprn == "151020766.0"
|
||||
|
||||
def test_uprn_source(self, epc: HistoricEpc) -> None:
|
||||
assert epc.uprn_source == "Energy Assessor"
|
||||
|
||||
def test_report_type(self, epc: HistoricEpc) -> None:
|
||||
assert epc.report_type == "100"
|
||||
|
||||
def test_improvement_summary_text(self, epc: HistoricEpc) -> None:
|
||||
assert epc.improvement_summary_text == "Increase loft insulation to 270 mm"
|
||||
|
||||
def test_indicative_cost(self, epc: HistoricEpc) -> None:
|
||||
assert epc.indicative_cost == "£100 - £350"
|
||||
Loading…
Add table
Reference in a new issue