mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
fixed unitt tests
This commit is contained in:
parent
8ff29603c3
commit
7bf897ceb4
1 changed files with 8 additions and 8 deletions
|
|
@ -43,7 +43,7 @@ class TestWindowRecommendations:
|
||||||
|
|
||||||
assert recommender.recommendation == [
|
assert recommender.recommendation == [
|
||||||
{
|
{
|
||||||
'phase': 0, 'parts': [], 'type': 'windows_glazing',
|
'phase': 0, 'parts': [], 'type': 'windows_glazing', "measure_type": "double_glazing",
|
||||||
'description': 'Install double glazing to all windows',
|
'description': 'Install double glazing to all windows',
|
||||||
'starting_u_value': None, 'new_u_value': None, 'sap_points': None, 'already_installed': False,
|
'starting_u_value': None, 'new_u_value': None, 'sap_points': None, 'already_installed': False,
|
||||||
'total': 7980.0, 'labour_hours': 0.0, 'labour_days': 0.0, 'is_secondary_glazing': False,
|
'total': 7980.0, 'labour_hours': 0.0, 'labour_days': 0.0, 'is_secondary_glazing': False,
|
||||||
|
|
@ -92,7 +92,7 @@ class TestWindowRecommendations:
|
||||||
|
|
||||||
assert recommender2.recommendation == [
|
assert recommender2.recommendation == [
|
||||||
{
|
{
|
||||||
'phase': 0, 'parts': [], 'type': 'windows_glazing',
|
'phase': 0, 'parts': [], 'type': 'windows_glazing', "measure_type": "double_glazing",
|
||||||
'description': 'Install double glazing to the remaining windows', 'starting_u_value': None,
|
'description': 'Install double glazing to the remaining windows', 'starting_u_value': None,
|
||||||
'new_u_value': None, 'sap_points': None, 'already_installed': False, 'total': 5700.0,
|
'new_u_value': None, 'sap_points': None, 'already_installed': False, 'total': 5700.0,
|
||||||
'labour_hours': 0.0,
|
'labour_hours': 0.0,
|
||||||
|
|
@ -193,7 +193,7 @@ class TestWindowRecommendations:
|
||||||
|
|
||||||
assert recommender5.recommendation == [
|
assert recommender5.recommendation == [
|
||||||
{
|
{
|
||||||
'phase': 0, 'parts': [], 'type': 'windows_glazing',
|
'phase': 0, 'parts': [], 'type': 'windows_glazing', 'measure_type': 'secondary_glazing',
|
||||||
'description': 'Install secondary glazing to the remaining windows', 'starting_u_value': None,
|
'description': 'Install secondary glazing to the remaining windows', 'starting_u_value': None,
|
||||||
'new_u_value': None, 'sap_points': None, 'already_installed': False, 'total': 4560.0,
|
'new_u_value': None, 'sap_points': None, 'already_installed': False, 'total': 4560.0,
|
||||||
'labour_hours': 0.0, 'labour_days': 0.0, 'is_secondary_glazing': True,
|
'labour_hours': 0.0, 'labour_days': 0.0, 'is_secondary_glazing': True,
|
||||||
|
|
@ -240,7 +240,7 @@ class TestWindowRecommendations:
|
||||||
|
|
||||||
assert recommender6.recommendation == [
|
assert recommender6.recommendation == [
|
||||||
{
|
{
|
||||||
'phase': 0, 'parts': [], 'type': 'windows_glazing',
|
'phase': 0, 'parts': [], 'type': 'windows_glazing', 'measure_type': 'secondary_glazing',
|
||||||
'description': 'Install secondary glazing to all windows. Secondary glazing recommended due to '
|
'description': 'Install secondary glazing to all windows. Secondary glazing recommended due to '
|
||||||
'herigate building status',
|
'herigate building status',
|
||||||
'starting_u_value': None, 'new_u_value': None, 'sap_points': None, 'already_installed': False,
|
'starting_u_value': None, 'new_u_value': None, 'sap_points': None, 'already_installed': False,
|
||||||
|
|
@ -396,7 +396,7 @@ class TestWindowRecommendations:
|
||||||
|
|
||||||
assert recommender9.recommendation == [
|
assert recommender9.recommendation == [
|
||||||
{
|
{
|
||||||
'phase': 0, 'parts': [], 'type': 'windows_glazing',
|
'phase': 0, 'parts': [], 'type': 'windows_glazing', 'measure_type': 'double_glazing',
|
||||||
'description': 'Install double glazing to all windows', 'starting_u_value': None, 'new_u_value': None,
|
'description': 'Install double glazing to all windows', 'starting_u_value': None, 'new_u_value': None,
|
||||||
'sap_points': None, 'already_installed': False, 'total': 7980.0, 'labour_hours': 0.0,
|
'sap_points': None, 'already_installed': False, 'total': 7980.0, 'labour_hours': 0.0,
|
||||||
'labour_days': 0.0, 'is_secondary_glazing': False,
|
'labour_days': 0.0, 'is_secondary_glazing': False,
|
||||||
|
|
@ -638,7 +638,8 @@ class TestWindowRecommendations:
|
||||||
'glazing_coverage_ending': 'full', 'id': '1+1'
|
'glazing_coverage_ending': 'full', 'id': '1+1'
|
||||||
}
|
}
|
||||||
|
|
||||||
assert simulated_data[0] == expected_simulated_outcome
|
# Make sure all keys are the same, apart from days_to_ending
|
||||||
|
assert all([v == expected_simulated_outcome[k] for k, v in simulated_data[0].items() if k != "days_to_ending"])
|
||||||
|
|
||||||
# has_glazing_ending and glazing_coverage_ending are not in the starting record - test for this in case it
|
# has_glazing_ending and glazing_coverage_ending are not in the starting record - test for this in case it
|
||||||
# changes
|
# changes
|
||||||
|
|
@ -648,7 +649,7 @@ class TestWindowRecommendations:
|
||||||
# Check which keys are different
|
# Check which keys are different
|
||||||
different = []
|
different = []
|
||||||
for k in simulated_data[0].keys():
|
for k in simulated_data[0].keys():
|
||||||
if k in ["id", 'has_glazing_ending', 'glazing_coverage_ending']:
|
if k in ["id", 'has_glazing_ending', 'glazing_coverage_ending', 'days_to_ending']:
|
||||||
continue
|
continue
|
||||||
if simulated_data[0][k] != starting_record[k]:
|
if simulated_data[0][k] != starting_record[k]:
|
||||||
different.append(
|
different.append(
|
||||||
|
|
@ -666,7 +667,6 @@ class TestWindowRecommendations:
|
||||||
'simulated': 'double glazing installed during or after 2002'},
|
'simulated': 'double glazing installed during or after 2002'},
|
||||||
{'variable': 'multi_glaze_proportion_ending', 'starting': 0.0, 'simulated': 100},
|
{'variable': 'multi_glaze_proportion_ending', 'starting': 0.0, 'simulated': 100},
|
||||||
{'variable': 'windows_energy_eff_ending', 'starting': 'Very Poor', 'simulated': 'Average'},
|
{'variable': 'windows_energy_eff_ending', 'starting': 'Very Poor', 'simulated': 'Average'},
|
||||||
{'variable': 'days_to_ending', 'starting': 3642, 'simulated': 3713}
|
|
||||||
]
|
]
|
||||||
|
|
||||||
assert different == expected_different
|
assert different == expected_different
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue