@@ -194,7 +194,6 @@ def test_infection_probability(
194
194
npt .assert_almost_equal (base_infection_probability , dynamic_population_exposure_model .infection_probability ())
195
195
196
196
197
- @pytest .mark .skip
198
197
def test_dynamic_total_probability_rule (
199
198
dynamic_infected_single_exposure_model : models .ExposureModel ,
200
199
dynamic_population_exposure_model : models .ExposureModel ):
@@ -207,27 +206,33 @@ def test_dynamic_total_probability_rule(
207
206
dynamic_population_exposure_model .total_probability_rule ()
208
207
209
208
210
- @pytest .mark .skip
211
- def test_dynamic_expected_new_cases (
212
- dynamic_infected_single_exposure_model : models .ExposureModel ,
213
- dynamic_population_exposure_model : models .ExposureModel ):
209
+ def test_exposure_model_group_structure (data_registry , full_exposure_model : models .ExposureModel ):
210
+ """
211
+ ExposureModels must have the same ConcentrationModel.
212
+ In this test the number of infected occupants is different.
213
+ """
214
+ another_full_exposure_model = dc_utils .nested_replace (full_exposure_model ,
215
+ {'concentration_model.infected.number' : 2 , })
216
+ with pytest .raises (ValueError , match = re .escape ("All ExposureModels must have the same ConcentrationModel." )):
217
+ models .ExposureModelGroup (data_registry , exposure_models = (full_exposure_model , another_full_exposure_model , ))
214
218
215
- with pytest .raises (NotImplementedError , match = re .escape ("Cannot compute expected new cases "
216
- "with dynamic occupancy" )):
217
- dynamic_infected_single_exposure_model .expected_new_cases ()
218
- with pytest .raises (NotImplementedError , match = re .escape ("Cannot compute expected new cases "
219
- "with dynamic occupancy" )):
220
- dynamic_population_exposure_model .expected_new_cases ()
221
219
220
+ def test_exposure_model_group_expected_new_cases (data_registry , full_exposure_model : models .ExposureModel ):
221
+ """
222
+ ExposureModelGroup expected number of new cases must
223
+ be the sum of expected new cases of each ExposureModel.
222
224
223
- @pytest .mark .skip
224
- def test_dynamic_reproduction_number (
225
- dynamic_infected_single_exposure_model : models .ExposureModel ,
226
- dynamic_population_exposure_model : models .ExposureModel ):
225
+ In this case, the number of exposed people is changing
226
+ between the two ExposureModel groups.
227
+ """
228
+ another_full_exposure_model = dc_utils .nested_replace (
229
+ full_exposure_model , {'exposed.number' : 5 , }
230
+ )
231
+ exposure_model_group = models .ExposureModelGroup (
232
+ data_registry = data_registry ,
233
+ exposure_models = (full_exposure_model , another_full_exposure_model , ),
234
+ )
227
235
228
- with pytest .raises (NotImplementedError , match = re .escape ("Cannot compute reproduction number "
229
- "with dynamic occupancy" )):
230
- dynamic_infected_single_exposure_model .reproduction_number ()
231
- with pytest .raises (NotImplementedError , match = re .escape ("Cannot compute reproduction number "
232
- "with dynamic occupancy" )):
233
- dynamic_population_exposure_model .reproduction_number ()
236
+ assert exposure_model_group .expected_new_cases () == (
237
+ full_exposure_model .expected_new_cases () + another_full_exposure_model .expected_new_cases ()
238
+ )
0 commit comments