Fix to use the updated PiecewiseConstant scheme for temperatures, and turn on testing, even if trivial, for the report generation.
This commit is contained in:
parent
2d69c7bfa8
commit
331b8e733f
3 changed files with 30 additions and 1 deletions
|
|
@ -157,7 +157,10 @@ def model_from_form(form: FormData, tmp_raw_form_data) -> models.Model:
|
|||
period, duration = 15, 120
|
||||
# I multiply the opening width by the number of windows to simulate the correct window area
|
||||
ventilation = models.WindowOpening(active=models.PeriodicInterval(period=period, duration=duration),
|
||||
inside_temp=293, outside_temp=283, cd_b=0.6,
|
||||
inside_temp=models.PiecewiseConstant((0, 24), (293, )),
|
||||
# TODO: This should be based on the month etc.
|
||||
outside_temp=models.PiecewiseConstant((0, 24), (283, )),
|
||||
cd_b=0.6,
|
||||
window_height=float(d['window_height']),
|
||||
opening_length=float(d['opening_distance']) * int(d['windows_number']))
|
||||
else:
|
||||
|
|
|
|||
21
cara/tests/apps/calculator/test_report_generator.py
Normal file
21
cara/tests/apps/calculator/test_report_generator.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import pytest
|
||||
|
||||
from cara.apps.calculator import model_generator
|
||||
from cara.apps.calculator import report_generator
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def baseline_form_data():
|
||||
return model_generator.baseline_raw_form_data()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def baseline_form(baseline_form_data):
|
||||
return model_generator.FormData.from_dict(baseline_form_data)
|
||||
|
||||
|
||||
def test_generate_report(baseline_form, baseline_form_data):
|
||||
model = baseline_form.build_model(baseline_form_data)
|
||||
|
||||
report = report_generator.build_report(model, baseline_form)
|
||||
assert report != ""
|
||||
5
setup.py
5
setup.py
|
|
@ -64,4 +64,9 @@ setup(
|
|||
# The 'all' extra is the union of all requirements.
|
||||
'all': [req for reqs in REQUIREMENTS.values() for req in reqs],
|
||||
},
|
||||
package_data={'cara': [
|
||||
'apps/calculator/*',
|
||||
'apps/calculator/*/*',
|
||||
'apps/calculator/*/*/*'
|
||||
]},
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue