Exemplo n.º 1
0
def test_mitigation_statement():
    st.cleanup()
    expected_doubling = "outbreak **reduces the doubling time to 7.8** days"
    display_header(st, MODEL, PARAM)
    assert [s for s in st.render_store if expected_doubling in s]
    # assert len((list(filter(lambda s: expected_doubling in s, st.render_store))))
    st.cleanup()
    expected_halving = "outbreak **halves the infections every 51.9** days"
    halving_params = Parameters(
        current_hospitalized=100,
        doubling_time=6.0,
        known_infected=5000,
        market_share=0.05,
        relative_contact_rate=0.7,
        susceptible=500000,
        hospitalized=RateLos(0.05, 7),
        icu=RateLos(0.02, 9),
        ventilated=RateLos(0.01, 10),
        n_days=60,
    )
    halving_model = SimSirModel(halving_params)
    display_header(st, halving_model, halving_params)
    assert [s for s in st.render_store if expected_halving in s]
    #assert len((list(filter(lambda s: expected_halving in s, st.render_store))))
    st.cleanup()
Exemplo n.º 2
0
def test_header_fail(mock_st, param):
    """
    Just proving to myself that these tests work
    """
    some_garbage = "ajskhlaeHFPIQONOI8QH34TRNAOP8ESYAW4"
    display_header(mock_st, param)
    assert len(list(filter(lambda s: some_garbage in s,
                           mock_st.render_store))), "This should fail"
Exemplo n.º 3
0
def test_penn_logo_in_header():
    penn_css = '<link rel="stylesheet" href="https://www1.pennmedicine.org/styles/shared/penn-medicine-header.css">'
    display_header(st, PARAM)
    assert len(list(
        filter(lambda s: penn_css in s,
               st.render_store))), "The Penn Medicine header should be printed"
Exemplo n.º 4
0
def header_test_helper(expected_str, model, param, mock_st):
    display_header(mock_st, model, param)
    assert [s for s in mock_st.render_store if expected_str in s
            ], f"Expected the string '{expected_str}' in the display header"
Exemplo n.º 5
0
def header_test_helper(expected_str, model, param):
    st.cleanup()
    display_header(st, model, param)
    assert [s for s in st.render_store if expected_str in s],\
        "Expected the string '{expected}' in the display header".format(expected=expected_str)
    st.cleanup()