mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Added test covering house for set_floor_level
This commit is contained in:
parent
2a601a3003
commit
e190b98586
2 changed files with 26 additions and 0 deletions
|
|
@ -650,6 +650,17 @@ class Property(Definitions):
|
|||
self.data["floor-level"] not in self.DATA_ANOMALY_MATCHES else None
|
||||
)
|
||||
|
||||
if self.floor_level is None:
|
||||
|
||||
if self.data["property-type"] != "Flat":
|
||||
return
|
||||
|
||||
if self.floor["another_property_below"]:
|
||||
self.floor_level = 1
|
||||
else:
|
||||
self.floor_level = 0
|
||||
return
|
||||
|
||||
# We perform some extra checks, if the property is not on the ground floor, as we have found cases
|
||||
# where a property is marked as being on the first floor
|
||||
if self.floor_level > 0:
|
||||
|
|
|
|||
|
|
@ -423,3 +423,18 @@ class TestProperty:
|
|||
prop3.set_floor_level()
|
||||
|
||||
assert prop3.floor_level == 2
|
||||
|
||||
# Example of a house
|
||||
prop4 = Property(1, "AB12CD", "Test Address", mock_epc_client)
|
||||
prop4.data = {'floor-level': '', 'property-type': 'House'}
|
||||
prop4.floor = {
|
||||
'original_description': '(Another dwelling below)', 'clean_description': 'Solid, no insulation',
|
||||
'thermal_transmittance': None, 'thermal_transmittance_unit': None, 'is_assumed': False,
|
||||
'is_to_unheated_space': False, 'is_to_external_air': False, 'is_suspended': False, 'is_solid': False,
|
||||
'another_property_below': False, 'insulation_thickness': 'none', 'floor_thermal_transmittance': None,
|
||||
'floor_insulation_thickness': 'none'
|
||||
}
|
||||
|
||||
prop4.set_floor_level()
|
||||
|
||||
assert prop4.floor_level is None
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue