From 306e7fc31d5f5cdc67ff248ba4665c4e57d33250 Mon Sep 17 00:00:00 2001 From: Nicolas Mounet Date: Thu, 12 Nov 2020 18:40:03 +0100 Subject: [PATCH] tests for modele_generator: replace test on presence intervals by two tests on infected and exposed presence intervals --- .../apps/calculator/test_model_generator.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/cara/tests/apps/calculator/test_model_generator.py b/cara/tests/apps/calculator/test_model_generator.py index 1dab481b..c20495ef 100644 --- a/cara/tests/apps/calculator/test_model_generator.py +++ b/cara/tests/apps/calculator/test_model_generator.py @@ -98,7 +98,7 @@ def test_ventilation_window_hepa(baseline_form): [baseline_form.ventilation().air_exchange(room, t) for t in ts]) -def test_present_intervals(baseline_form): +def test_infected_present_intervals(baseline_form): baseline_form.coffee_duration = 15 baseline_form.coffee_breaks = 2 baseline_form.activity_start = 9 * 60 @@ -108,9 +108,21 @@ def test_present_intervals(baseline_form): baseline_form.infected_start = 10 * 60 baseline_form.infected_finish = 15 * 60 correct = ((10, 11), (11.25, 12.5), (13.5, 15.0)) - assert baseline_form.present_interval().present_times == correct + assert baseline_form.infected_present_interval().present_times == correct +def test_exposed_present_intervals(baseline_form): + baseline_form.coffee_duration = 15 + baseline_form.coffee_breaks = 2 + baseline_form.activity_start = 9 * 60 + baseline_form.activity_finish = 17 * 60 + baseline_form.lunch_start = 12 * 60 + 30 + baseline_form.lunch_finish = 13 * 60 + 30 + baseline_form.infected_start = 10 * 60 + baseline_form.infected_finish = 15 * 60 + correct = ((9, 11), (11.25, 12.5), (13.5, 17.0)) + assert baseline_form.exposed_present_interval().present_times == correct + def test_key_validation(baseline_form_data): baseline_form_data['activity_type'] = 'invalid key' with pytest.raises(ValueError):