fixed windows recommendations tests

This commit is contained in:
Khalim Conn-Kowlessar 2026-01-20 23:55:26 +00:00
parent 1a90a04eb7
commit 243b0ff2d4

View file

@ -91,10 +91,15 @@ class TestWindowRecommendations:
address='1',
epc_record=epc_record
)
property_2.windows = {'original_description': 'Mostly double glazing', 'has_glazing': True,
'glazing_coverage': 'most',
'glazing_type': 'double', 'no_data': False}
property_2.windows = {
'original_description': 'Mostly double glazing',
'clean_description': 'Mostly double glazing',
'has_glazing': True,
'glazing_coverage': 'most',
'glazing_type': 'double', 'no_data': False
}
property_2.number_of_windows = 7
property_2.already_installed = []
recommender2 = WindowsRecommendations(property_instance=property_2, materials=materials)
@ -102,26 +107,16 @@ class TestWindowRecommendations:
recommender2.recommend()
assert recommender2.recommendation == [
{
'phase': 0, 'parts': [], 'type': 'windows_glazing', "measure_type": "double_glazing",
'description': 'Install double glazing to the remaining windows', 'starting_u_value': None,
'new_u_value': None, 'sap_points': None, 'already_installed': False, 'total': 5700.0,
'labour_hours': 0.0,
'labour_days': 0.0, 'is_secondary_glazing': False,
'description_simulation': {
'multi-glaze-proportion': 100, 'windows-energy-eff': 'Good',
'windows-description': 'Fully double glazed',
'glazed-type': 'double glazing installed during or after 2002'
},
'simulation_config': {
'glazing_coverage_ending': 'full', 'multi_glaze_proportion_ending': 100,
'windows_energy_eff_ending': 'Good', 'glazing_type_ending': 'double',
'glazed_type_ending': 'double glazing installed during or after 2002'
},
"survey": None
}
]
assert len(recommender2.recommendation) == 1
assert recommender2.recommendation[0]["total"] == np.float64(5700.0)
assert recommender2.recommendation[0]["phase"] == 0
assert recommender2.recommendation[0]["description"] == 'Install double glazing to all windows'
assert recommender2.recommendation[0]["contingency"] == np.float64(855.0)
assert recommender2.recommendation[0]["simulation_config"] == {
'glazing_coverage_ending': 'full', 'multi_glaze_proportion_ending': 100,
'windows_energy_eff_ending': 'Good', 'glazing_type_ending': 'double',
'glazed_type_ending': 'double glazing installed during or after 2002'
}
def test_fully_double_glazed(self):
"""
@ -140,10 +135,14 @@ class TestWindowRecommendations:
address='1',
epc_record=epc_record
)
property_3.windows = {'original_description': 'Fully double glazed', 'has_glazing': True,
'glazing_coverage': 'full',
'glazing_type': 'double', 'no_data': False}
property_3.windows = {
'original_description': 'Fully double glazed', 'clean_description': 'Fully double glazed',
'has_glazing': True,
'glazing_coverage': 'full',
'glazing_type': 'double', 'no_data': False
}
property_3.number_of_windows = 7
property_3.already_installed = []
recommender3 = WindowsRecommendations(property_instance=property_3, materials=materials)
@ -166,10 +165,15 @@ class TestWindowRecommendations:
address='1',
epc_record=epc_record
)
property_4.windows = {'original_description': 'Full secondary glazing', 'has_glazing': True,
'glazing_coverage': 'full',
'glazing_type': 'secondary', 'no_data': False}
property_4.windows = {
'original_description': 'Full secondary glazing',
'clean_description': 'Full secondary glazing',
'has_glazing': True,
'glazing_coverage': 'full',
'glazing_type': 'secondary', 'no_data': False
}
property_4.number_of_windows = 7
property_4.already_installed = []
recommender4 = WindowsRecommendations(property_instance=property_4, materials=materials)
@ -193,10 +197,15 @@ class TestWindowRecommendations:
address='1',
epc_record=epc_record
)
property_5.windows = {'original_description': 'Partial secondary glazing', 'has_glazing': True,
'glazing_coverage': 'partial',
'glazing_type': 'secondary', 'no_data': False}
property_5.windows = {
'original_description': 'Partial secondary glazing',
'clean_description': 'Partial secondary glazing',
'has_glazing': True,
'glazing_coverage': 'partial',
'glazing_type': 'secondary', 'no_data': False
}
property_5.number_of_windows = 7
property_5.already_installed = []
recommender5 = WindowsRecommendations(property_instance=property_5, materials=materials)
@ -204,25 +213,15 @@ class TestWindowRecommendations:
recommender5.recommend()
assert recommender5.recommendation == [
{
'phase': 0, 'parts': [], 'type': 'windows_glazing', 'measure_type': 'secondary_glazing',
'description': 'Install secondary glazing to the remaining windows', 'starting_u_value': None,
'new_u_value': None, 'sap_points': None, 'already_installed': False, 'total': 4560.0,
'labour_hours': 0.0, 'labour_days': 0.0, 'is_secondary_glazing': True,
'description_simulation': {
'multi-glaze-proportion': 100, 'windows-energy-eff': 'Good',
'windows-description': 'Full secondary glazing',
'glazed-type': 'secondary glazing'
},
'simulation_config': {
'glazing_coverage_ending': 'full', 'multi_glaze_proportion_ending': 100,
'windows_energy_eff_ending': 'Good', 'glazing_type_ending': 'secondary',
'glazed_type_ending': 'secondary glazing'
},
"survey": None
}
]
assert len(recommender5.recommendation) == 1
assert recommender5.recommendation[0]["total"] == np.float64(4560.0)
assert recommender5.recommendation[0]["phase"] == 0
assert recommender5.recommendation[0]["description"] == 'Install double glazing to all windows'
assert recommender5.recommendation[0]["contingency"] == np.float64(684.0)
assert recommender5.recommendation[0]["simulation_config"] == {
'glazing_coverage_ending': 'full', 'glazing_type_ending': 'multiple', 'multi_glaze_proportion_ending': 100,
'windows_energy_eff_ending': 'Average', 'glazed_type_ending': 'secondary glazing'
}
def test_single_glazed_restricted_measures(self):
epc_record = EPCRecord()
@ -316,7 +315,8 @@ class TestWindowRecommendations:
epc_record=epc_record
)
property_8.windows = {
'original_description': 'Mostly triple glazing', 'clean_description': 'Mostly triple glazing',
'original_description': 'Mostly triple glazing',
'clean_description': 'Mostly triple glazing',
'has_glazing': True,
'glazing_coverage': 'most',
'glazing_type': 'triple', 'no_data': False