def test_value_error_for_negative_counts(self): with pytest.raises(ValueError): attributable_community_risk(-5, 1, 1, 1)
def test_compare_to_formula(self): acr_formula = (25 + 10) / 100 - 10 / 50 acr = attributable_community_risk(25, 25, 10, 40) npt.assert_allclose(acr, acr_formula)
def test_acr_is_zero(self): acr = attributable_community_risk(25, 25, 25, 25) assert acr == 0