Model/epc_data/tests/test_attribute_utils.py
2023-06-14 10:23:27 +01:00

22 lines
779 B
Python

from epc_data.attributes.attribute_utils import extract_thermal_transmittance, clean_description
def test_extract_thermal_transmittance():
description = "average thermal transmittance 2.3 w/m-¦k"
assert extract_thermal_transmittance({}, description) == (
{'thermal_transmittance': 2.3, 'thermal_transmittance_unit': 'w/m-¦k'}, '')
def test_clean_description():
test_cases = [
("this:is;a*test", "this is a test"),
("hello@world", "hello world"),
("what?!?", "what "),
("hello(world)", "hello world "),
("", ""),
(":;*@?!", " "),
("no special chars", "no special chars")
]
for input_str, expected_output in test_cases:
assert clean_description(input_str) == expected_output