コード例 #1
0
 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]
コード例 #2
0
    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