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 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
