added validation for window venting duration < window venting frequency
This commit is contained in:
parent
a16e1f1fc9
commit
814f1dc625
2 changed files with 13 additions and 0 deletions
|
|
@ -254,6 +254,11 @@ class FormData:
|
|||
"window_opening_regime cannot be 'not-applicable' if "
|
||||
"ventilation_type is 'natural_ventilation'"
|
||||
)
|
||||
if (self.window_opening_regime == 'windows_open_periodically' and
|
||||
self.windows_duration > self.windows_frequency):
|
||||
raise ValueError(
|
||||
'Duration cannot be bigger than frequency.'
|
||||
)
|
||||
|
||||
if (self.ventilation_type == 'mechanical_ventilation'
|
||||
and self.mechanical_ventilation_type == 'not-applicable'):
|
||||
|
|
|
|||
|
|
@ -508,6 +508,14 @@ def test_key_validation_natural_ventilation_window_opening_regime_na(baseline_fo
|
|||
model_generator.FormData.from_dict(baseline_form_data)
|
||||
|
||||
|
||||
def test_natural_ventilation_window_opening_periodically(baseline_form: model_generator.FormData):
|
||||
baseline_form.window_opening_regime = 'windows_open_periodically'
|
||||
baseline_form.windows_duration = 20
|
||||
baseline_form.windows_frequency = 10
|
||||
with pytest.raises(ValueError, match='Duration cannot be bigger than frequency.'):
|
||||
baseline_form.validate()
|
||||
|
||||
|
||||
def test_key_validation_mech_ventilation_type_na(baseline_form_data):
|
||||
baseline_form_data['ventilation_type'] = 'mechanical_ventilation'
|
||||
baseline_form_data['mechanical_ventilation_type'] = 'not-applicable'
|
||||
|
|
|
|||
Loading…
Reference in a new issue