mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
fixed tests for test_extract_thermal_transmittance
This commit is contained in:
parent
a5feff3472
commit
f97566cba1
2 changed files with 6 additions and 38 deletions
|
|
@ -29,28 +29,6 @@ def extract_thermal_transmittence(result: dict, description: str) -> Tuple[
|
|||
return result, description
|
||||
|
||||
|
||||
def search_split_description(desc: str) -> str:
|
||||
"""
|
||||
Searches split descriptions and looks for key words, determining a description about the roof's/floor's insulation.
|
||||
|
||||
:param desc: Description to be searched.
|
||||
:return: Result of the search.
|
||||
"""
|
||||
outputs = {
|
||||
"insulated": "average",
|
||||
"limited": "below average",
|
||||
"no insulation": "none",
|
||||
"limited insulation": "below average",
|
||||
}
|
||||
|
||||
out = outputs.get(desc, None)
|
||||
|
||||
if out:
|
||||
return out
|
||||
|
||||
raise NotImplementedError("Handle me")
|
||||
|
||||
|
||||
def extract_component_types(result: dict, description: str, list_of_components: list) -> Tuple[
|
||||
Dict[str, Union[None, str, float]], str
|
||||
]:
|
||||
|
|
@ -63,7 +41,7 @@ def extract_component_types(result: dict, description: str, list_of_components:
|
|||
"""
|
||||
for component in list_of_components:
|
||||
result[f'is_{component.replace(" ", "_")}'] = component in description
|
||||
# Remove the roof type from the description
|
||||
# Remove the component from the description
|
||||
description = description.replace(component, "")
|
||||
|
||||
return result, description
|
||||
|
|
|
|||
|
|
@ -1,17 +1,7 @@
|
|||
import pytest
|
||||
from epc_data.attributes.attribute_utils import extract_thermal_transmittence, search_split_description
|
||||
from epc_data.attributes.attribute_utils import extract_thermal_transmittence
|
||||
|
||||
|
||||
def test__extract_thermal_transmittence():
|
||||
description = "U-value of 2.3 w/m-¦k"
|
||||
assert extract_thermal_transmittence(description) == (2.3, "w/m-¦k")
|
||||
|
||||
|
||||
def test__search_split_roof_description():
|
||||
assert search_split_description("insulated") == "average"
|
||||
assert search_split_description("limited") == "below average"
|
||||
assert search_split_description("no insulation") == "none"
|
||||
assert search_split_description("limited insulation") == "below average"
|
||||
|
||||
with pytest.raises(NotImplementedError):
|
||||
search_split_description("unknown")
|
||||
def test_extract_thermal_transmittance():
|
||||
description = "average thermal transmittance 2.3 w/m-¦k"
|
||||
assert extract_thermal_transmittence({}, description) == (
|
||||
{'thermal_transmittance': 2.3, 'thermal_transmittance_unit': 'w/m-¦k'}, '')
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue