Skip to content

Commit a251c8e

Browse files
committed
Check population monotonicity conditions
1 parent 842e6b3 commit a251c8e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/test_app.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,16 @@ def test_model_raw_end():
329329
assert round(last.susceptible, 0) == 83391.0
330330

331331

332+
def test_model_monotonicity():
333+
param = copy(PARAM)
334+
model = Model(param)
335+
raw_df = model.raw_df
336+
337+
# Susceptible population should be non-increasing, and Recovered non-decreasing
338+
assert (raw_df.susceptible[1:] - raw_df.susceptible.shift(1)[1:] <= 0).all()
339+
assert (raw_df.recovered [1:] - raw_df.recovered. shift(1)[1:] >= 0).all()
340+
341+
332342
def test_model_cumulative_census():
333343
# test that census is being properly calculated
334344
param = copy(PARAM)

0 commit comments

Comments
 (0)