fixed floor recommendations tests

This commit is contained in:
Khalim Conn-Kowlessar 2024-09-30 15:42:44 +01:00
parent 1d06653a73
commit 80579989fc
2 changed files with 267 additions and 899 deletions

File diff suppressed because it is too large Load diff

View file

@ -7,11 +7,15 @@ from recommendations.tests.test_data.materials import materials
from backend.Property import Property
# import inspect
#
# file_path = inspect.getfile(lambda: None)
# with open(
# os.path.abspath(os.path.dirname(__file__)) + "/recommendations/tests/test_data/input_properties.pkl", "rb"
# os.path.abspath(os.path.dirname(file_path)) + "/recommendations/tests/test_data/input_properties.pkl", "rb"
# ) as f:
# input_properties = pickle.load(f)
class TestFloorRecommendations:
@pytest.fixture
@ -59,6 +63,7 @@ class TestFloorRecommendations:
input_properties[2].floor_type = "suspended"
input_properties[2].number_of_floors = 1
input_properties[2].floor_level = 0
input_properties[2].already_installed = []
recommender = FloorRecommendations(property_instance=input_properties[2], materials=materials)
assert recommender.estimated_u_value is None
@ -71,8 +76,8 @@ class TestFloorRecommendations:
assert types == {"suspended_floor_insulation"}
assert len(recommender.recommendations) == 6
assert recommender.recommendations[0]["total"] == 4925.205
assert len(recommender.recommendations) == 1
assert recommender.recommendations[0]["total"] == 4687.5
assert recommender.recommendations[0]["new_u_value"] == 0.21
def test_uvalue_0_12(self, input_properties):
@ -108,6 +113,7 @@ class TestFloorRecommendations:
input_properties[4].floor_type = "solid"
input_properties[4].number_of_floors = 1
input_properties[4].floor_level = 0
input_properties[4].already_installed = []
# In this case, we have no county, so in this case, it should yse the local-authority-label if possible
input_properties[4].data["county"] = ""