Merge pull request #352 from Hestia-Homes/roof-u-values-tests

added additional room roof unit tests
This commit is contained in:
KhalimCK 2024-10-08 19:44:39 +01:00 committed by GitHub
commit 60ac197060
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 114 additions and 3 deletions

View file

@ -248,7 +248,7 @@ def extract_thickness(thickness, is_roof_room, is_at_rafters, is_loft, is_flat):
thickness_map = {
"below average": "50",
"average": "100",
"above average": "270",
"above average": "150",
"none": "0",
}
thickness = thickness_map[thickness]
@ -287,7 +287,7 @@ def get_u_value_from_s9(
):
return None
if thickness in [0, "0"] and is_loft:
if thickness in [0, "0"] and (is_loft or is_roof_room):
return None
# Determine the column to refer based on the roof type

View file

@ -352,4 +352,115 @@ roof_uvalue_test_cases = [
'age_band': 'L',
'uvalue': 0.18
},
# Room roof - age band A
{
'insulation_thickness': 'none',
'is_loft': False,
'is_roof_room': True,
'is_thatched': False,
'has_dwelling_above': False,
'is_flat': False,
'is_pitched': False,
'is_at_rafters': False,
'age_band': 'A',
'uvalue': 2.3
},
{
'insulation_thickness': 'below average',
'is_loft': False,
'is_roof_room': True,
'is_thatched': False,
'has_dwelling_above': False,
'is_flat': False,
'is_pitched': False,
'is_at_rafters': False,
'age_band': 'A',
'uvalue': 0.68
},
{
'insulation_thickness': 'average',
'is_loft': False,
'is_roof_room': True,
'is_thatched': False,
'has_dwelling_above': False,
'is_flat': False,
'is_pitched': False,
'is_at_rafters': False,
'age_band': 'A',
'uvalue': 0.4
},
{
'insulation_thickness': 'above average',
'is_loft': False,
'is_roof_room': True,
'is_thatched': False,
'has_dwelling_above': False,
'is_flat': False,
'is_pitched': False,
'is_at_rafters': False,
'age_band': 'A',
'uvalue': 0.3
},
# Room roof - age band E
{
'insulation_thickness': 'none',
'is_loft': False,
'is_roof_room': True,
'is_thatched': False,
'has_dwelling_above': False,
'is_flat': False,
'is_pitched': False,
'is_at_rafters': False,
'age_band': 'E',
'uvalue': 1.5
},
{
'insulation_thickness': 'average',
'is_loft': False,
'is_roof_room': True,
'is_thatched': False,
'has_dwelling_above': False,
'is_flat': False,
'is_pitched': False,
'is_at_rafters': False,
'age_band': 'E',
'uvalue': 0.4
},
# Room roof - age band H
{
'insulation_thickness': 'none',
'is_loft': False,
'is_roof_room': True,
'is_thatched': False,
'has_dwelling_above': False,
'is_flat': False,
'is_pitched': False,
'is_at_rafters': False,
'age_band': 'H',
'uvalue': 0.35
},
{
'insulation_thickness': 'below average',
'is_loft': False,
'is_roof_room': True,
'is_thatched': False,
'has_dwelling_above': False,
'is_flat': False,
'is_pitched': False,
'is_at_rafters': False,
'age_band': 'H',
'uvalue': 0.68
},
{
'insulation_thickness': 'average',
'is_loft': False,
'is_roof_room': True,
'is_thatched': False,
'has_dwelling_above': False,
'is_flat': False,
'is_pitched': False,
'is_at_rafters': False,
'age_band': 'H',
'uvalue': 0.4
},
]

View file

@ -198,7 +198,7 @@ class TestRecommendationUtils:
}
u_value = recommendation_utils.get_roof_u_value(**inputs)
assert u_value == 0.16, f"Expected 0.16, but got {u_value}"
assert u_value == 0.3, f"Expected 0.3, but got {u_value}"
def test_get_roof_u_value_case_8(self):
# Test case where there is a dwelling above the roof, U-value should be 0