def test_sort_all_animals_by_fitness(self):
        """Tests if the sort all animals by fitness method sorts a sample of animals placed
           on a location by fitness.
           """
        i = Island()
        loc = (2, 7)
        for _ in range(10):
            Herbivore(i, loc)
            Carnivore(i, loc)

        local_herb_list = i.get_herb_list_on_loc(loc)
        local_carn_list = i.get_carn_list_on_loc(loc)
        local_herb_list.sort(key=lambda herb: herb.fitness, reverse=True)
        local_carn_list.sort(key=lambda carn: carn.fitness, reverse=True)

        i.sort_all_animals_by_fitness()

        assert i.get_herb_list_on_loc(loc) == local_herb_list
        assert i.get_carn_list_on_loc(loc) == local_carn_list
    def test_get_herb_list_on_loc(self):
        """Tests if get herb list on loc method retrieves herb list attribute of
           cell on locatrion.
           """
        i = Island()
        loc = (1, 8)
        for _ in range(3):
            Herbivore(i, loc)

        herb_list_manually = i.island_dict[loc].herb_pop_list
        assert i.get_herb_list_on_loc(loc) == herb_list_manually