diff --git a/model_data/epc_attributes/RoofAttributes.py b/model_data/epc_attributes/RoofAttributes.py index af56cdbb..f0f3e8f6 100644 --- a/model_data/epc_attributes/RoofAttributes.py +++ b/model_data/epc_attributes/RoofAttributes.py @@ -16,7 +16,7 @@ class RoofAttributes(BaseUtility): self.description: str = description.lower() self.nodata = not description or description in self.DATA_ANOMALY_MATCHES - if not description or not any( + if not self.nodata and not any( rt in self.description for rt in self.ROOF_TYPES + self.DWELLING_ABOVE + ["average thermal transmittance"] ): raise ValueError('Invalid description') diff --git a/model_data/tests/test_roof_attributes.py b/model_data/tests/test_roof_attributes.py index 70016651..2ee4e12a 100644 --- a/model_data/tests/test_roof_attributes.py +++ b/model_data/tests/test_roof_attributes.py @@ -22,8 +22,8 @@ class TestRoofAttributes: assert floor_attr.description == valid_description.lower() # Test initialization with an empty description - with pytest.raises(ValueError): - RoofAttributes('') + ra = RoofAttributes('') + assert ra.nodata with pytest.raises(ValueError): RoofAttributes('description without keywords') @@ -85,11 +85,13 @@ class TestRoofAttributes: assert result[k] == expected_output[k] def test_clean_roof_invalid(self): - with pytest.raises(ValueError): - RoofAttributes('').process() with pytest.raises(ValueError): RoofAttributes('nonsense string').process() + def test_clean_roof_no_description(self): + roof = RoofAttributes('').process() + assert roof == {} + def test_clean_roof_edge_cases(self): # Insulation thickness edge case assert RoofAttributes('Pitched, 99999 mm loft insulation').process()['insulation_thickness'] == "99999"