import pytest from model_data.epc_attributes.WallAttributes import WallAttributes from model_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 @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() # Ensure the output ordering is correct assert sorted(result.items()) == sorted(expected_result.items())