def test_probabilities_returns_none_surrounded_by_ocean(self): """Test to show probabilities returns none when surrounded by ocean """ loc = (1, 2) h = Herbivore(self.spes_island, loc) loc_list = h.get_potential_coordinates() assert h.probabilities(loc_list) is None
def test_destination_is_none_surrounded_by_ocean(self): """Test to show that destination is none while surrounded by ocean """ loc = (1, 2) h = Herbivore(self.spes_island, loc) loc_list = h.get_potential_coordinates() assert h.destination(loc_list) is None
def test_total_propensity_surrounded_by_desert(self): """Test to show that total_propensity returns value based on formula when surrounded by desert """ loc = (6, 9) h = Herbivore(self.i, loc) loc_list = h.get_potential_coordinates() assert h.total_propensity(loc_list) == 4
def test_get_potential_coordinates_gives_neighbour_coord(self): """Test to show that get_potential_coordinates returns the neighbouring coordinates """ loc = (2, 2) neighbour_coord = [(3, 2), (1, 2), (2, 3), (2, 1)] h = Herbivore(self.i, loc) assert h.get_potential_coordinates() == neighbour_coord
def test_destination_gives_coordinate(self, mocker): """Test to show that destination returns destination when mocked to a probability of 100% at different indexes """ mocker.return_value = [1, 0, 0, 0] i = Island() loc = (2, 8) h = Herbivore(i, loc) loc_list = h.get_potential_coordinates() assert h.destination(loc_list) == loc_list[0] mocker.return_value = [0, 1, 0, 0] assert h.destination(loc_list) == loc_list[1]