|
51 | 51 | )
|
52 | 52 |
|
53 | 53 | PARAM = Parameters(
|
| 54 | + current_date=datetime(year=2020, month=3, day=28), |
54 | 55 | current_hospitalized=100,
|
55 | 56 | doubling_time=6.0,
|
56 | 57 | market_share=0.05,
|
|
63 | 64 | )
|
64 | 65 |
|
65 | 66 | HALVING_PARAM = Parameters(
|
| 67 | + current_date=datetime(year=2020, month=3, day=28), |
66 | 68 | current_hospitalized=100,
|
67 | 69 | doubling_time=6.0,
|
68 | 70 | market_share=0.05,
|
@@ -295,11 +297,11 @@ def test_model_raw_start():
|
295 | 297 |
|
296 | 298 | assert first.susceptible == 499600.0
|
297 | 299 | assert round(second.infected, 0) == 449.0
|
298 |
| - assert list(model.dispositions_df.iloc[0, :]) == [-43, date(year=2020, month=2, day=15), 1.0, 0.4, 0.2] |
| 300 | + assert list(model.dispositions_df.iloc[0, :]) == [-43, date(year=2020, month=2, day=14), 1.0, 0.4, 0.2] |
299 | 301 | assert round(raw_df.recovered[30], 0) == 7083.0
|
300 | 302 |
|
301 | 303 | d, dt, s, i, r = list(model.dispositions_df.iloc[60, :])
|
302 |
| - assert dt == date(year=2020, month=4, day=15) |
| 304 | + assert dt == date(year=2020, month=4, day=14) |
303 | 305 | assert [round(v, 0) for v in (d, s, i, r)] == [17, 549.0, 220.0, 110.0]
|
304 | 306 |
|
305 | 307 |
|
@@ -329,6 +331,16 @@ def test_model_raw_end():
|
329 | 331 | assert round(last.susceptible, 0) == 83391.0
|
330 | 332 |
|
331 | 333 |
|
| 334 | +def test_model_monotonicity(): |
| 335 | + param = copy(PARAM) |
| 336 | + model = Model(param) |
| 337 | + raw_df = model.raw_df |
| 338 | + |
| 339 | + # Susceptible population should be non-increasing, and Recovered non-decreasing |
| 340 | + assert (raw_df.susceptible[1:] - raw_df.susceptible.shift(1)[1:] <= 0).all() |
| 341 | + assert (raw_df.recovered [1:] - raw_df.recovered. shift(1)[1:] >= 0).all() |
| 342 | + |
| 343 | + |
332 | 344 | def test_model_cumulative_census():
|
333 | 345 | # test that census is being properly calculated
|
334 | 346 | param = copy(PARAM)
|
|
0 commit comments