def test_home_education_home_removal_of_education_act( person_home_education_home): household = Household(1) person = person_home_education_home household.add(person) policy = policies.RemoveEducationActivity(1) policy.apply_to(household) assert [p.act for p in household.people[1].activities] == ['home'] assert household.people[1].plan[0].start_time == minutes_to_datetime(0) assert household.people[1].plan[0].end_time == minutes_to_datetime(24 * 60 - 1)
def person_home_education_home(): person = Person(1) person.add( Activity(seq=1, act='home', area='a', start_time=minutes_to_datetime(0), end_time=minutes_to_datetime(60))) person.add( Leg(seq=1, mode='car', start_area='a', end_area='b', start_time=minutes_to_datetime(60), end_time=minutes_to_datetime(90))) person.add( Activity(seq=2, act='education', area='b', start_time=minutes_to_datetime(90), end_time=minutes_to_datetime(120))) person.add( Leg(seq=2, mode='car', start_area='b', end_area='a', start_time=minutes_to_datetime(120), end_time=minutes_to_datetime(180))) person.add( Activity(seq=3, act='home', area='a', start_time=minutes_to_datetime(180), end_time=minutes_to_datetime(24 * 60 - 1))) return person
def test_home_education_home_education_home_removal_of_education_act(): household = Household(1) person = Person(1) person.add( Activity(seq=1, act='home', area='a', start_time=minutes_to_datetime(0), end_time=minutes_to_datetime(60))) person.add( Leg(seq=1, mode='car', start_area='a', end_area='b', start_time=minutes_to_datetime(60), end_time=minutes_to_datetime(90))) person.add( Activity(seq=2, act='education', area='b', start_time=minutes_to_datetime(90), end_time=minutes_to_datetime(120))) person.add( Leg(seq=2, mode='car', start_area='b', end_area='a', start_time=minutes_to_datetime(120), end_time=minutes_to_datetime(180))) person.add( Activity(seq=3, act='home', area='a', start_time=minutes_to_datetime(180), end_time=minutes_to_datetime(300))) person.add( Leg(seq=3, mode='car', start_area='a', end_area='b', start_time=minutes_to_datetime(300), end_time=minutes_to_datetime(390))) person.add( Activity(seq=2, act='education', area='b', start_time=minutes_to_datetime(390), end_time=minutes_to_datetime(520))) person.add( Leg(seq=2, mode='car', start_area='b', end_area='a', start_time=minutes_to_datetime(520), end_time=minutes_to_datetime(580))) person.add( Activity(seq=3, act='home', area='a', start_time=minutes_to_datetime(680), end_time=minutes_to_datetime(24 * 60 - 1))) household.add(person) policy = policies.RemoveEducationActivity(1) policy.apply_to(household) assert [p.act for p in household.people[1].activities] == ['home'] assert household.people[1].plan[0].start_time == minutes_to_datetime(0) assert household.people[1].plan[0].end_time == minutes_to_datetime(24 * 60 - 1)
def test_home_work_home_education_home_removal_of_education_act(): household = Household(1) person = Person(1) person.add( Activity(seq=1, act='home', area='a', start_time=minutes_to_datetime(0), end_time=minutes_to_datetime(60))) person.add( Leg(seq=1, mode='car', start_area='a', end_area='b', start_time=minutes_to_datetime(60), end_time=minutes_to_datetime(90))) person.add( Activity(seq=2, act='work', area='b', start_time=minutes_to_datetime(90), end_time=minutes_to_datetime(120))) person.add( Leg(seq=2, mode='car', start_area='b', end_area='a', start_time=minutes_to_datetime(120), end_time=minutes_to_datetime(180))) person.add( Activity(seq=3, act='home', area='a', start_time=minutes_to_datetime(180), end_time=minutes_to_datetime(300))) person.add( Leg(seq=3, mode='car', start_area='a', end_area='b', start_time=minutes_to_datetime(300), end_time=minutes_to_datetime(390))) person.add( Activity(seq=2, act='education', area='b', start_time=minutes_to_datetime(390), end_time=minutes_to_datetime(520))) person.add( Leg(seq=2, mode='car', start_area='b', end_area='a', start_time=minutes_to_datetime(520), end_time=minutes_to_datetime(580))) person.add( Activity(seq=3, act='home', area='a', start_time=minutes_to_datetime(680), end_time=minutes_to_datetime(24 * 60 - 1))) household.add(person) policy = policies.RemoveEducationActivity(1) policy.apply_to(household)
def test_minutes_to_dt(m, expected): assert minutes_to_datetime(m) == expected