def test_locations_equal(): locationa = Location(loc=None, link=1, area=2) locationb = Location(loc=None, link=None, area=2) locationc = Location(loc=None, link=2, area=1) locationd = Location(loc=None, link=2, area=None) locatione = Location(loc=None, link=2, area=2) assert locationa == locationb assert locationc == locationd assert not locationb == locationc assert not locationa == locatione
def test_move_activity_with_different_default(): plan = Plan('a') plan.add(Activity(1, 'home', area='a')) plan.add(Leg(1)) plan.add(Activity(2, 'shop', area='b')) plan.add(Leg(2)) plan.add(Activity(3, 'home', area='a')) new_loc = Location(area='heyooo') plan.move_activity(2, default=new_loc) assert plan[2].location == new_loc
def test_move_activity_with_different_default_updates_legs(): plan = Plan('a') plan.add(Activity(1, 'home', area='a')) plan.add(Leg(1)) plan.add(Activity(2, 'shop', area='b')) plan.add(Leg(2)) plan.add(Activity(3, 'home', area='a')) new_loc = Location(area='heyooo') plan.move_activity(2, default=new_loc) assert plan[1].end_location == new_loc assert plan[3].start_location == new_loc
def test_locations_equal_with_no_shared_location_type(): locationb = Location(loc=None, link=None, area=2) locationd = Location(loc=None, link=2, area=None) with pytest.raises(UserWarning): assert not locationb == locationd
def test_location_gets(): location = Location(loc=None, link=1, area=2) assert location.min == 1 assert location.max == 2
def test_home(person_heh): assert person_heh.plan.home == Location(area='a')