Example #1
0
def test_apply_two_policies(population):
    policy1 = modify.HouseholdQuarantined(.1)
    policy2 = modify.PersonStayAtHome(.4)
    counter = 0
    modify.apply_policies(population, [policy1, policy2])
    for hid, household in population.households.items():
        assert len(household.people) == 2
        for pid, person in household.people.items():
            counter += len(person.plan) == 1
    assert counter < 60  # super dodgy test with probability
Example #2
0
def test_apply_full_person_stay_at_home(population):
    policy = modify.PersonStayAtHome(1)
    modify.apply_policies(population, [policy])
    for hid, household in population.households.items():
        for pid, person in household.people.items():
            assert_single_home_activity(person)
Example #3
0
def test_apply_person_based_full_hh_quarantine_doesnt_create_or_delete_households(
        population):
    policy = modify.HouseholdQuarantined(modify.PersonProbability(1))
    modify.apply_policies(population, [policy])
    assert len(population.households) == 20
Example #4
0
def test_apply_person_based_full_quarantine(population):
    policy = modify.HouseholdQuarantined(modify.PersonProbability(1))
    modify.apply_policies(population, [policy])
    for hid, household in population.households.items():
        for pid, person in household.people.items():
            assert_single_home_activity(person)
Example #5
0
def test_apply_full_hh_quarantine_doesnt_create_or_delete_households(
        population):
    policy = modify.HouseholdQuarantined(1)
    modify.apply_policies(population, [policy])
    assert len(population.households) == 20