diff --git a/epc_data/tests/test_wall_attributes.py b/epc_data/tests/test_wall_attributes.py index d76c4556..f0dd55de 100644 --- a/epc_data/tests/test_wall_attributes.py +++ b/epc_data/tests/test_wall_attributes.py @@ -40,11 +40,21 @@ class TestWallAttributes: assert result['internal_insulation'] is True assert result['external_insulation'] is False - def test_wall_attributes(self): - for test_case in wall_cases: - result = WallAttributes(test_case['original_description']).process() - # Ensure the output ordering is correct - expected_result = {key: test_case[key] for key in result.keys()} - expected_result["desc"] = test_case["original_description"] - result["desc"] = test_case["original_description"] - assert result == expected_result + @pytest.mark.parametrize( + "test_case", + wall_cases + ) + def test_wall_attributes(self, test_case): + expected_result = test_case.copy() + del expected_result["original_description"] + result = WallAttributes(test_case['original_description']).process() + assert set(result.keys()) == { + 'is_as_built', 'is_assumed', 'is_sandstone_or_limestone', 'thermal_transmittance', + 'is_cavity_wall', 'is_filled_cavity', 'is_system_built', + 'external_insulation', 'is_solid_brick', 'is_timber_frame', 'internal_insulation', + 'is_cob', 'is_granite_or_whinstone', 'insulation_thickness', + 'thermal_transmittance_unit' + } + + # Ensure the output ordering is correct + assert sorted(result.items()) == sorted(expected_result.items()) diff --git a/epc_data/tests/test_window_attributes.py b/epc_data/tests/test_window_attributes.py new file mode 100644 index 00000000..6c21b86b --- /dev/null +++ b/epc_data/tests/test_window_attributes.py @@ -0,0 +1,30 @@ +import pytest +from epc_data.attributes.WindowAttributes import WindowAttributes +from epc_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