|
9 | 9 |
|
10 | 10 | from src.penn_chime.charts import new_admissions_chart, admitted_patients_chart, chart_descriptions
|
11 | 11 | from src.penn_chime.models import sir, sim_sir, build_admissions_df
|
12 |
| -from src.penn_chime.parameters import Parameters |
| 12 | +from src.penn_chime.parameters import Parameters, daily_growth_helper |
13 | 13 | from src.penn_chime.presentation import display_header
|
14 | 14 | from src.penn_chime.settings import DEFAULTS
|
15 | 15 | from src.penn_chime.defaults import RateLos
|
@@ -79,11 +79,33 @@ def test_daily_growth():
|
79 | 79 | assert len((list(filter(lambda s: initial_growth in s, st.render_store))))
|
80 | 80 | assert len((list(filter(lambda s: mitigated_growth in s, st.render_store))))
|
81 | 81 | st.cleanup()
|
| 82 | + mitigated_halving = "and daily growth rate of **-1.33%**." |
| 83 | + halving_params = Parameters( |
| 84 | + current_hospitalized=100, |
| 85 | + doubling_time=6.0, |
| 86 | + known_infected=5000, |
| 87 | + market_share=0.05, |
| 88 | + relative_contact_rate=0.7, |
| 89 | + susceptible=500000, |
| 90 | + hospitalized=RateLos(0.05, 7), |
| 91 | + icu=RateLos(0.02, 9), |
| 92 | + ventilated=RateLos(0.01, 10), |
| 93 | + n_days=60, |
| 94 | + ) |
| 95 | + display_header(st, halving_params) |
| 96 | + assert len((list(filter(lambda s: mitigated_halving in s, st.render_store)))) |
| 97 | + st.cleanup() |
82 | 98 |
|
83 | 99 |
|
84 | 100 | st.cleanup()
|
85 | 101 |
|
86 | 102 |
|
| 103 | +def test_daily_growth_helper(): |
| 104 | + assert np.round(daily_growth_helper(5), decimals=4) == 14.8698 |
| 105 | + assert np.round(daily_growth_helper(0), decimals=4) == 0.0 |
| 106 | + assert np.round(daily_growth_helper(-4), decimals=4) == -15.9104 |
| 107 | + |
| 108 | + |
87 | 109 | @pytest.mark.xfail()
|
88 | 110 | def test_header_fail():
|
89 | 111 | """
|
|
0 commit comments