From 92fce7f093fbbe83ad7890e46c3de872c234f977 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Mon, 7 Oct 2024 11:03:52 +0100 Subject: [PATCH] Updating ligtiung unit test to include measure_type --- backend/Property.py | 2 +- .../tests/test_lighting_recommendations.py | 22 ++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/backend/Property.py b/backend/Property.py index 9108d40c..be5479c5 100644 --- a/backend/Property.py +++ b/backend/Property.py @@ -112,7 +112,7 @@ class Property: self.measures = ast.literal_eval(measures) if measures else None self.uprn = epc_record.get("uprn") - self.uprn_source = self.data["uprn-source"] + self.uprn_source = self.data.get("uprn-source") self.full_sap_epc = epc_record.get("full_sap_epc") self.in_conservation_area, self.is_listed, self.is_heritage = None, None, None diff --git a/recommendations/tests/test_lighting_recommendations.py b/recommendations/tests/test_lighting_recommendations.py index 96440c01..32d607de 100644 --- a/recommendations/tests/test_lighting_recommendations.py +++ b/recommendations/tests/test_lighting_recommendations.py @@ -41,12 +41,18 @@ class TestLightingRecommendations: assert len(lr.recommendation) == 1 assert lr.recommendation == [ - {'phase': 0, 'parts': [], 'type': 'low_energy_lighting', - 'description': 'Install low energy lighting in 4 outlets', 'starting_u_value': None, 'new_u_value': None, - 'already_installed': False, 'sap_points': 0.4, 'kwh_savings': 219.0, 'co2_equivalent_savings': 0.035478, - 'description_simulation': {'lighting-energy-eff': 'Very Good', - 'lighting-description': 'Low energy lighting in all fixed outlets', - 'low-energy-lighting': 100}, 'total': 240.24, 'subtotal': 200.20000000000002, - 'vat': 40.040000000000006, 'contingency': 14.3, 'preliminaries': 14.3, 'material': 80.0, 'profit': 28.6, - 'labour_hours': 3.2, 'labour_days': 0.4, 'labour_cost': 63.0, 'survey': False} + { + 'phase': 0, 'parts': [], 'type': 'low_energy_lighting', 'measure_type': 'low_energy_lighting', + 'description': 'Install low energy lighting in 4 outlets', 'starting_u_value': None, + 'new_u_value': None, + 'already_installed': False, 'sap_points': 0.4, 'kwh_savings': 219.0, 'co2_equivalent_savings': 0.035478, + 'description_simulation': { + 'lighting-energy-eff': 'Very Good', + 'lighting-description': 'Low energy lighting in all fixed outlets', + 'low-energy-lighting': 100 + }, + 'total': 240.24, 'subtotal': 200.20000000000002, + 'vat': 40.040000000000006, 'contingency': 14.3, 'preliminaries': 14.3, 'material': 80.0, 'profit': 28.6, + 'labour_hours': 3.2, 'labour_days': 0.4, 'labour_cost': 63.0, 'survey': False + } ]