mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
import pytest
|
|
from model_data.epc_attributes.WindowAttributes import WindowAttributes
|
|
from model_data.tests.test_data.test_window_attributes_cases import windows_cases
|
|
|
|
|
|
class TestWindowAttributes:
|
|
|
|
def test_init(self):
|
|
# Test initialization with a valid description
|
|
valid_description = 'fully glazed, triple glazing'
|
|
window_attr = WindowAttributes(valid_description)
|
|
assert window_attr.description == valid_description.lower()
|
|
|
|
# Test initialization with an empty description
|
|
empty_description = ''
|
|
window_attr_empty = WindowAttributes(empty_description)
|
|
assert window_attr_empty.nodata
|
|
|
|
# Test initialization with a description that contains none of the keywords
|
|
with pytest.raises(ValueError):
|
|
WindowAttributes('description without keywords')
|
|
|
|
@pytest.mark.parametrize(
|
|
"case",
|
|
windows_cases
|
|
)
|
|
def test_process(self, case):
|
|
output = WindowAttributes(case['original_description']).process()
|
|
expected_output = {key: case[key] for key in output.keys()}
|
|
assert output == expected_output
|