mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Added remaining windows unit tests
This commit is contained in:
parent
ebad3d7dd6
commit
654a0715fa
2 changed files with 118 additions and 3 deletions
|
|
@ -79,7 +79,7 @@ class WindowsRecommendations:
|
|||
if self.property.is_listed:
|
||||
description += ". Secondary glazing recommended due to listed building status"
|
||||
elif self.property.is_heritage:
|
||||
description += ". Secondary glazing recommended due to conservation area status"
|
||||
description += ". Secondary glazing recommended due to herigate building status"
|
||||
elif self.property.in_conservation_area:
|
||||
description += ". Secondary glazing recommended due to conservation area status"
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,122 @@ class TestWindowRecommendations:
|
|||
assert not recommender4.recommendation
|
||||
|
||||
def test_partial_secondary_glazing(self):
|
||||
pass
|
||||
property_5 = Property(
|
||||
id=1,
|
||||
postcode='1',
|
||||
address1='1',
|
||||
epc_client=Mock(),
|
||||
data={
|
||||
"county": "Wychavon",
|
||||
"multi-glaze-proportion": 50
|
||||
}
|
||||
)
|
||||
property_5.windows = {'original_description': 'Partial secondary glazing', 'has_glazing': True,
|
||||
'glazing_coverage': 'partial',
|
||||
'glazing_type': 'secondary', 'no_data': False}
|
||||
property_5.number_of_windows = 7
|
||||
|
||||
recommender5 = WindowsRecommendations(property_instance=property_5, materials=materials)
|
||||
|
||||
assert not recommender5.recommendation
|
||||
|
||||
recommender5.recommend()
|
||||
|
||||
assert recommender5.recommendation == [
|
||||
{'parts': [], 'type': 'window_glazing', 'description': 'Install secondary glazing to the remaining windows',
|
||||
'starting_u_value': None, 'new_u_value': None, 'sap_points': None, 'total': 1089.893952,
|
||||
'subtotal': 908.24496, 'vat': 181.64899200000002, 'contingency': 64.87464, 'preliminaries': 64.87464,
|
||||
'material': 729.0, 'profit': 129.74928, 'labour_hours': 13.0, 'labour_cost': 568.4928,
|
||||
'labour_days': 0.8125}]
|
||||
|
||||
def test_single_glazed_restricted_measures(self):
|
||||
pass
|
||||
property_6 = Property(
|
||||
id=1,
|
||||
postcode='1',
|
||||
address1='1',
|
||||
epc_client=Mock(),
|
||||
data={
|
||||
"county": "Wychavon",
|
||||
"multi-glaze-proportion": 0
|
||||
}
|
||||
)
|
||||
property_6.windows = {'original_description': 'Single glazed', 'has_glazing': False, 'glazing_coverage': None,
|
||||
'glazing_type': 'single',
|
||||
'no_data': False}
|
||||
property_6.number_of_windows = 7
|
||||
property_6.restricted_measures = True
|
||||
property_6.is_heritage = True
|
||||
|
||||
recommender6 = WindowsRecommendations(property_instance=property_6, materials=materials)
|
||||
|
||||
assert not recommender6.recommendation
|
||||
|
||||
recommender6.recommend()
|
||||
|
||||
assert recommender6.recommendation == [
|
||||
{'parts': [], 'type': 'window_glazing',
|
||||
'description': 'Install secondary glazing to all windows. Secondary '
|
||||
'glazing recommended due to herigate building status',
|
||||
'starting_u_value': None, 'new_u_value': None, 'sap_points': None,
|
||||
'total': 1907.314416, 'subtotal': 1589.42868, 'vat': 317.885736,
|
||||
'contingency': 113.53062, 'preliminaries': 113.53062,
|
||||
'material': 1275.75, 'profit': 227.06124, 'labour_hours': 22.75,
|
||||
'labour_cost': 994.8624, 'labour_days': 1.421875}
|
||||
]
|
||||
|
||||
def test_full_triple_glazed(self):
|
||||
property_7 = Property(
|
||||
id=1,
|
||||
postcode='1',
|
||||
address1='1',
|
||||
epc_client=Mock(),
|
||||
data={
|
||||
"county": "Wychavon",
|
||||
"multi-glaze-proportion": 100
|
||||
}
|
||||
)
|
||||
property_7.windows = {'original_description': 'Fully triple glazed', 'has_glazing': True,
|
||||
'glazing_coverage': 'full',
|
||||
'glazing_type': 'triple', 'no_data': False}
|
||||
property_7.number_of_windows = 7
|
||||
|
||||
recommender7 = WindowsRecommendations(property_instance=property_7, materials=materials)
|
||||
|
||||
assert not recommender7.recommendation
|
||||
|
||||
recommender7.recommend()
|
||||
|
||||
assert not recommender7.recommendation
|
||||
|
||||
def test_partial_triple_glazed(self):
|
||||
"""
|
||||
We should just recommend double glazing to the remaining windows, since it's a cheaper option
|
||||
"""
|
||||
|
||||
property_8 = Property(
|
||||
id=1,
|
||||
postcode='1',
|
||||
address1='1',
|
||||
epc_client=Mock(),
|
||||
data={
|
||||
"county": "Wychavon",
|
||||
"multi-glaze-proportion": 80
|
||||
}
|
||||
)
|
||||
property_8.windows = {'original_description': 'Mostly triple glazing', 'has_glazing': True,
|
||||
'glazing_coverage': 'most',
|
||||
'glazing_type': 'triple', 'no_data': False}
|
||||
property_8.number_of_windows = 7
|
||||
|
||||
recommender8 = WindowsRecommendations(property_instance=property_8, materials=materials)
|
||||
|
||||
assert not recommender8.recommendation
|
||||
|
||||
recommender8.recommend()
|
||||
|
||||
assert recommender8.recommendation == [
|
||||
{'parts': [], 'type': 'window_glazing', 'description': 'Install double glazing to the remaining windows',
|
||||
'starting_u_value': None, 'new_u_value': None, 'sap_points': None, 'total': 1634.840928,
|
||||
'subtotal': 1362.36744, 'vat': 272.47348800000003, 'contingency': 97.31196, 'preliminaries': 97.31196,
|
||||
'material': 364.5, 'profit': 194.62392, 'labour_hours': 13.0, 'labour_cost': 284.2464,
|
||||
'labour_days': 0.8125}]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue