mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
handling missing roof description
This commit is contained in:
parent
7ad2b3d46b
commit
d3a494a7e7
2 changed files with 28 additions and 0 deletions
|
|
@ -300,6 +300,10 @@ class RoofRecommendations:
|
|||
):
|
||||
return False
|
||||
|
||||
if self.property.roof["original_description"] is None:
|
||||
# There is no description so we cannot make an assessment
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
|
|
|
|||
|
|
@ -8,6 +8,30 @@ from recommendations.tests.test_data.materials import materials
|
|||
|
||||
class TestRoofRecommendations:
|
||||
|
||||
def test_null_roof_description(self):
|
||||
epc_record = EPCRecord()
|
||||
epc_record.prepared_epc = {
|
||||
"county": "Cambridgeshire",
|
||||
}
|
||||
property_instance = Property(id=0, address="fake", postcode="fake", epc_record=epc_record)
|
||||
property_instance.age_band = "F"
|
||||
property_instance.insulation_floor_area = 100
|
||||
property_instance.roof = {
|
||||
'original_description': None,
|
||||
'clean_description': None,
|
||||
'thermal_transmittance': None,
|
||||
'thermal_transmittance_unit': None,
|
||||
'is_pitched': True, 'is_roof_room': False, 'is_loft': False, 'is_flat': False, 'is_thatched': False,
|
||||
'is_at_rafters': False, 'is_assumed': True, 'has_dwelling_above': False, 'is_valid': True,
|
||||
'insulation_thickness': 'none', 'roof_thermal_transmittance': None, 'roof_insulation_thickness': None
|
||||
}
|
||||
property_instance.already_installed = []
|
||||
|
||||
roof_recommender = RoofRecommendations(property_instance=property_instance, materials=materials)
|
||||
roof_recommender.recommend(phase=0)
|
||||
|
||||
assert not roof_recommender.recommendations
|
||||
|
||||
def test_loft_insulation_recommendation_no_insulation(self):
|
||||
epc_record = EPCRecord()
|
||||
epc_record.prepared_epc = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue