mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Allow empty roof description
This commit is contained in:
parent
0f12f9cae4
commit
a4d4e09680
2 changed files with 7 additions and 5 deletions
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue