mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
31 lines
1.2 KiB
Python
31 lines
1.2 KiB
Python
import pytest
|
|
from etl.epc_clean.epc_attributes.WindowAttributes import WindowAttributes
|
|
from etl.epc_clean.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 a description that contains none of the keywords
|
|
with pytest.raises(ValueError):
|
|
WindowAttributes('description without keywords')
|
|
|
|
def test_empty_str(self):
|
|
# Test initialization with an empty description
|
|
assert WindowAttributes("").process() == {
|
|
'has_glazing': False, 'glazing_coverage': None, 'glazing_type': None, 'no_data': True
|
|
}
|
|
|
|
@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
|