示例#1
0
def test__allocate_patient_release_patient(hospitals, health_info, selector):
    dummy_person = Person().from_attributes(age=80, sex='m')
    selector.infect_person_at_time(dummy_person, 0.0)
    dummy_person.area = MockArea(hospitals.members[-1].coordinates)
    assert dummy_person.medical_facility is None
    dummy_person.health_information.infection.symptoms.tag = getattr(
        SymptomTag, health_info)
    hospitals.allocate_patient(dummy_person)
    if health_info == "hospitalised":
        assert (
            dummy_person
            in hospitals.members[-1][Hospital.SubgroupType.patients].people)
    elif health_info == "intensive_care":
        assert (dummy_person in hospitals.members[-1][
            Hospital.SubgroupType.icu_patients].people)
    selected_hospital = dummy_person.medical_facility
    assert dummy_person.medical_facility is not None
    dummy_person.medical_facility.group.release_as_patient(dummy_person)
    assert dummy_person.medical_facility is None
示例#2
0
def test_try_allocate_patient_to_full_hospital(hospitals, health_info,
                                               selector):
    dummy_person = Person().from_attributes(age=80, sex='m')
    selector.infect_person_at_time(dummy_person, 0.0)
    dummy_person.health_information.infection.symptoms.tag = getattr(
        SymptomTag, health_info)

    dummy_person.area = MockArea(hospitals.members[0].coordinates)

    for hospital in hospitals.members:
        for _ in range(int(hospital.n_beds)):
            hospital.add_as_patient(dummy_person)

    hospitals.allocate_patient(dummy_person)
    if health_info == 'hospitalised':
        assert len(dummy_person.medical_facility.people
                   ) > dummy_person.medical_facility.group.n_beds
    elif health_info == 'intensive_care':
        assert len(dummy_person.medical_facility.people
                   ) > dummy_person.medical_facility.group.n_icu_beds

    for hospital in hospitals.members:
        for _ in range(int(hospital.n_beds)):
            hospital.release_as_patient(dummy_person)