mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
fixing existing unit tests
This commit is contained in:
parent
5201cab4a9
commit
b2beb2f122
4 changed files with 46 additions and 15 deletions
31
Makefile
31
Makefile
|
|
@ -1,5 +1,30 @@
|
||||||
setup:
|
# Project Makefile
|
||||||
pip install tox
|
|
||||||
|
|
||||||
|
PYTHON = python
|
||||||
|
|
||||||
|
.PHONY: setup test lint typecheck check clean
|
||||||
|
|
||||||
|
# Install dev dependencies + tox
|
||||||
|
setup:
|
||||||
|
$(PYTHON) -m pip install --upgrade pip
|
||||||
|
$(PYTHON) -m pip install tox black ruff mypy
|
||||||
|
|
||||||
|
# Run tests (pass ARGS="..." for specific tests)
|
||||||
test:
|
test:
|
||||||
tox
|
tox -- $(ARGS)
|
||||||
|
|
||||||
|
# Code formatting check + linting
|
||||||
|
lint:
|
||||||
|
ruff .
|
||||||
|
black --check .
|
||||||
|
|
||||||
|
# Static type checks
|
||||||
|
typecheck:
|
||||||
|
mypy .
|
||||||
|
|
||||||
|
# Full quality check (all checks + tests)
|
||||||
|
check: lint typecheck test
|
||||||
|
|
||||||
|
# Clean up tox environments
|
||||||
|
clean:
|
||||||
|
rm -rf .tox
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class TestSolarPvRecommendations:
|
||||||
property_instance_valid_all = Property(id=1, address="", postcode="", epc_record=epc_record)
|
property_instance_valid_all = Property(id=1, address="", postcode="", epc_record=epc_record)
|
||||||
property_instance_valid_all.roof_area = 40
|
property_instance_valid_all.roof_area = 40
|
||||||
property_instance_valid_all.number_of_floors = 2
|
property_instance_valid_all.number_of_floors = 2
|
||||||
property_instance_valid_all.roof = {"is_flat": True}
|
property_instance_valid_all.roof = {"is_flat": True, "thermal_transmittance": None}
|
||||||
property_instance_valid_all.solar_panel_configuration = {
|
property_instance_valid_all.solar_panel_configuration = {
|
||||||
"panel_performance": pd.DataFrame(
|
"panel_performance": pd.DataFrame(
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class TestVentilationRecommendations:
|
||||||
|
|
||||||
assert not recommender.recommendation
|
assert not recommender.recommendation
|
||||||
|
|
||||||
recommender.recommend()
|
recommender.recommend(phase=None)
|
||||||
|
|
||||||
assert len(recommender.recommendation) == 1
|
assert len(recommender.recommendation) == 1
|
||||||
|
|
||||||
|
|
@ -40,7 +40,7 @@ class TestVentilationRecommendations:
|
||||||
|
|
||||||
assert not recommender2.recommendation
|
assert not recommender2.recommendation
|
||||||
|
|
||||||
recommender2.recommend()
|
recommender2.recommend(phase=None)
|
||||||
|
|
||||||
assert len(recommender2.recommendation) == 1
|
assert len(recommender2.recommendation) == 1
|
||||||
|
|
||||||
|
|
@ -62,7 +62,7 @@ class TestVentilationRecommendations:
|
||||||
|
|
||||||
assert not recommender3.recommendation
|
assert not recommender3.recommendation
|
||||||
|
|
||||||
recommender3.recommend()
|
recommender3.recommend(phase=None)
|
||||||
|
|
||||||
assert len(recommender3.recommendation) == 1
|
assert len(recommender3.recommendation) == 1
|
||||||
|
|
||||||
|
|
@ -84,7 +84,7 @@ class TestVentilationRecommendations:
|
||||||
|
|
||||||
assert not recommender4.recommendation
|
assert not recommender4.recommendation
|
||||||
|
|
||||||
recommender4.recommend()
|
recommender4.recommend(phase=None)
|
||||||
|
|
||||||
assert not recommender4.recommendation
|
assert not recommender4.recommendation
|
||||||
assert recommender4.has_ventilaion
|
assert recommender4.has_ventilaion
|
||||||
|
|
@ -101,7 +101,7 @@ class TestVentilationRecommendations:
|
||||||
|
|
||||||
assert not recommender5.recommendation
|
assert not recommender5.recommendation
|
||||||
|
|
||||||
recommender5.recommend()
|
recommender5.recommend(phase=None)
|
||||||
|
|
||||||
assert not recommender5.recommendation
|
assert not recommender5.recommendation
|
||||||
assert recommender5.has_ventilaion
|
assert recommender5.has_ventilaion
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,8 @@ class TestWindowRecommendations:
|
||||||
'has_glazing_ending': True, 'glazing_type_ending': 'double',
|
'has_glazing_ending': True, 'glazing_type_ending': 'double',
|
||||||
'multi_glaze_proportion_ending': 100, 'windows_energy_eff_ending': 'Good',
|
'multi_glaze_proportion_ending': 100, 'windows_energy_eff_ending': 'Good',
|
||||||
'glazed_type_ending': 'double glazing installed during or after 2002'
|
'glazed_type_ending': 'double glazing installed during or after 2002'
|
||||||
}
|
},
|
||||||
|
"survey": None
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -106,7 +107,8 @@ class TestWindowRecommendations:
|
||||||
'glazing_coverage_ending': 'full', 'multi_glaze_proportion_ending': 100,
|
'glazing_coverage_ending': 'full', 'multi_glaze_proportion_ending': 100,
|
||||||
'windows_energy_eff_ending': 'Good', 'glazing_type_ending': 'double',
|
'windows_energy_eff_ending': 'Good', 'glazing_type_ending': 'double',
|
||||||
'glazed_type_ending': 'double glazing installed during or after 2002'
|
'glazed_type_ending': 'double glazing installed during or after 2002'
|
||||||
}
|
},
|
||||||
|
"survey": None
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -206,7 +208,8 @@ class TestWindowRecommendations:
|
||||||
'glazing_coverage_ending': 'full', 'multi_glaze_proportion_ending': 100,
|
'glazing_coverage_ending': 'full', 'multi_glaze_proportion_ending': 100,
|
||||||
'windows_energy_eff_ending': 'Good', 'glazing_type_ending': 'secondary',
|
'windows_energy_eff_ending': 'Good', 'glazing_type_ending': 'secondary',
|
||||||
'glazed_type_ending': 'secondary glazing'
|
'glazed_type_ending': 'secondary glazing'
|
||||||
}
|
},
|
||||||
|
"survey": None
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -254,8 +257,9 @@ class TestWindowRecommendations:
|
||||||
'has_glazing_ending': True, 'glazing_coverage_ending': 'full',
|
'has_glazing_ending': True, 'glazing_coverage_ending': 'full',
|
||||||
'glazing_type_ending': 'secondary', 'multi_glaze_proportion_ending': 100,
|
'glazing_type_ending': 'secondary', 'multi_glaze_proportion_ending': 100,
|
||||||
'windows_energy_eff_ending': 'Good', 'glazed_type_ending': 'secondary glazing'
|
'windows_energy_eff_ending': 'Good', 'glazed_type_ending': 'secondary glazing'
|
||||||
}
|
},
|
||||||
}
|
"survey": None
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
def test_full_triple_glazed(self):
|
def test_full_triple_glazed(self):
|
||||||
|
|
@ -383,6 +387,7 @@ class TestWindowRecommendations:
|
||||||
'glazing_type': 'single',
|
'glazing_type': 'single',
|
||||||
'no_data': False
|
'no_data': False
|
||||||
}
|
}
|
||||||
|
property_9.perimeter = 23.430749027719962
|
||||||
|
|
||||||
property_9.number_of_windows = 7
|
property_9.number_of_windows = 7
|
||||||
property_9.restricted_measures = False
|
property_9.restricted_measures = False
|
||||||
|
|
@ -410,7 +415,8 @@ class TestWindowRecommendations:
|
||||||
'glazing_type_ending': 'double', 'multi_glaze_proportion_ending': 100,
|
'glazing_type_ending': 'double', 'multi_glaze_proportion_ending': 100,
|
||||||
'windows_energy_eff_ending': 'Good',
|
'windows_energy_eff_ending': 'Good',
|
||||||
'glazed_type_ending': 'double glazing installed during or after 2002'
|
'glazed_type_ending': 'double glazing installed during or after 2002'
|
||||||
}
|
},
|
||||||
|
"survey": None
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue