import pytest from epc_data.attributes.WallAttributes import WallAttributes from epc_data.tests.test_data.test_wall_attributes_cases import wall_cases class TestWallAttributes: @pytest.fixture def wall_attr(self): def _wall_attr(description): return WallAttributes(description) return _wall_attr def test_thermal_transmittance(self, wall_attr): description = 'average thermal transmittance -4.67 w/m-¦k' wa = wall_attr(description) result = wa.process() assert result['thermal_transmittance'] == -4.67 assert result['thermal_transmittance_unit'] == 'w/m-¦k' def test_wall_types(self, wall_attr): description = 'solid brick system built' wa = wall_attr(description) result = wa.process() assert result['is_solid_brick'] is True assert result['is_system_built'] is True assert result['is_timber_frame'] is False def test_insulation_thickness(self, wall_attr): description = 'additional insulation' wa = wall_attr(description) result = wa.process() assert result['insulation_thickness'] == 'above average' def test_insulation_type(self, wall_attr): description = 'internal insulation' wa = wall_attr(description) result = wa.process() 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