diff --git a/datatypes/epc/loaders/__init__.py b/datatypes/epc/loaders/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/datatypes/epc/loaders/historic_epc.py b/datatypes/epc/loaders/historic_epc.py new file mode 100644 index 00000000..8555a706 --- /dev/null +++ b/datatypes/epc/loaders/historic_epc.py @@ -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") diff --git a/datatypes/epc/schema/historic_epc.py b/datatypes/epc/schema/historic_epc.py index e158ac1f..9ebe4b09 100644 --- a/datatypes/epc/schema/historic_epc.py +++ b/datatypes/epc/schema/historic_epc.py @@ -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 diff --git a/datatypes/epc/schema/tests/test_historic_epc_loading.py b/datatypes/epc/schema/tests/test_historic_epc_loading.py new file mode 100644 index 00000000..d5d5ea22 --- /dev/null +++ b/datatypes/epc/schema/tests/test_historic_epc_loading.py @@ -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"