mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
updating recommendation utils tests
This commit is contained in:
parent
d9a82984f8
commit
93a21e5436
2 changed files with 18 additions and 3 deletions
|
|
@ -282,11 +282,14 @@ def get_u_value_from_s9(
|
|||
):
|
||||
"""Get the U-value from table S9 based on the insulation thickness."""
|
||||
|
||||
if thickness in ["below average", "average", "above average", "none", None, "0", 0] or (
|
||||
if thickness in ["below average", "average", "above average", "none", None] or (
|
||||
not is_loft and not is_roof_room and not is_at_rafters
|
||||
):
|
||||
return None
|
||||
|
||||
if thickness in [0, "0"] and is_loft:
|
||||
return None
|
||||
|
||||
# Determine the column to refer based on the roof type
|
||||
column = (
|
||||
"Thatched_roof_U_value_W_m2K"
|
||||
|
|
@ -294,8 +297,11 @@ def get_u_value_from_s9(
|
|||
else "Slates_or_tiles_U_value_W_m2K"
|
||||
)
|
||||
|
||||
# Get the correct U-value based on the insulation thickness
|
||||
return s9[s9["Insulation_thickness_mm"] >= thickness][column].iloc[0]
|
||||
if thickness in [0, "0"] and is_roof_room:
|
||||
return s9[pd.isnull(s9["Insulation_thickness_mm"])][column].iloc[0]
|
||||
else:
|
||||
# Get the correct U-value based on the insulation thickness
|
||||
return s9[s9["Insulation_thickness_mm"] >= thickness][column].iloc[0]
|
||||
|
||||
|
||||
def get_roof_u_value(
|
||||
|
|
|
|||
|
|
@ -231,6 +231,15 @@ class TestRecommendationUtils:
|
|||
expected_uvalue = test_case["uvalue"]
|
||||
inputs = test_case.copy()
|
||||
del inputs["uvalue"]
|
||||
# insulation_thickness = inputs["insulation_thickness"]
|
||||
# has_dwelling_above = inputs["has_dwelling_above"]
|
||||
# is_loft = inputs["is_loft"]
|
||||
# is_roof_room = inputs["is_roof_room"]
|
||||
# is_thatched = inputs["is_thatched"]
|
||||
# age_band = inputs["age_band"]
|
||||
# is_flat = inputs["is_flat"]
|
||||
# is_pitched = inputs["is_pitched"]
|
||||
# is_at_rafters = inputs["is_at_rafters"]
|
||||
uvalue = recommendation_utils.get_roof_u_value(**inputs)
|
||||
assert expected_uvalue == uvalue, f"Expected u value {expected_uvalue}, recieved {uvalue}"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue