def test_migration_does_not_happen_if_destination_none( self, mocker_1, mocker_2): """Test to show that migration does not happen if destination is none. destination() is mocked to None, and will_move() is mocked to True. """ mocker_1.return_value = None mocker_2.return_value = True i = Island() loc = (2, 7) h = Herbivore(i, loc) old_loc = h.get_loc() h.migrate() new_loc = h.get_loc() assert old_loc == new_loc #SJEKK GJENNOM HVORFOR DU IKKE FÅR 100%
def test_migration_removes_pop_from_loc_and_adds_to_odder(self, mocker): """Test to show that migration removes population from initial loc to the chosen destination when the mocked value for will_move is set to True """ mocker.return_value = True loc_with_one_place_to_move = (1, 1) i = Island(self.spes_geogr_2) h = Herbivore(i, loc_with_one_place_to_move) old_loc = h.get_loc() h.migrate() new_loc = h.get_loc() assert i.get_num_herb_on_loc(old_loc) == 0 assert i.get_num_herb_on_loc(new_loc) == 1 assert old_loc != new_loc