Skip to content
This repository was archived by the owner on Mar 6, 2024. It is now read-only.

Duct location bugfix #199

Merged
merged 2 commits into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions hescorehpxml/schemas/hescore_json.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2598,6 +2598,55 @@
}
}
}
},
{
"if": {
"properties": {
"zone": {
"properties": {
"zone_roof": {
"not": {
"contains": {
"properties": {
"roof_type": {"enum": ["vented_attic", "cond_attic"]}
},
"required": ["roof_type"]
}
}
}
}
}
}
},
"then": {
"properties": {
"systems": {
"properties": {
"hvac": {
"contains": {
"properties": {
"hvac_distribution": {
"properties": {
"duct": {
"not": {
"contains": {
"properties": {
"location": {"const": "uncond_attic"}
},
"required": ["location"]
}
}
}
}
}
}
},
"error_msg": "duct/location[\"uncond_attic\"] is not allowed as there is no attic."
}
}
}
}
}
}
]
}
Expand Down
13 changes: 13 additions & 0 deletions tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,19 @@ def test_invalid_hvac_distribution(hpxml_filebase):
assert "'sealed' is a required property" in errors


@pytest.mark.parametrize('hpxml_filebase', hescore_examples)
def test_invalid_duct_location(hpxml_filebase):
schema = get_json_schema()
js_schema = jsonschema.Draft7Validator(schema, format_checker=jsonschema.FormatChecker())
js = get_example_json(hpxml_filebase)

js1 = copy.deepcopy(js)
js1['building']['zone']['zone_roof'][0]['roof_type'] = "cath_ceiling"
js1['building']['systems']['hvac'][0]['hvac_distribution']['duct'][0]['location'] = "uncond_attic"
errors = get_error_messages(js1, js_schema)
assert "duct/location[\"uncond_attic\"] is not allowed as there is no attic." in errors


@pytest.mark.parametrize('hpxml_filebase', hescore_examples)
def test_invalid_domestic_hot_water(hpxml_filebase):
schema = get_json_schema()
Expand Down