def test_carn_doesnt_eat_when_no_herbs_available(self, example_properties): """ Asserts that carnivore hasn't gained weight after eat method when there are no herbivores to be eaten. """ carnivore = Carnivore(example_properties) old_weight = carnivore.weight pop_herb = [] carnivore.attempt_eating_all_herbivores_in_cell(pop_herb) assert carnivore.weight == old_weight
def test_carn_gained_weight_after_eating(self, example_properties, teardown_carnivore_tests): """ Assert that carnivore has gained weight after eat method when there is a weaker herbivore available. """ carnivore = Carnivore(example_properties) carnivore.find_fitness() old_weight = carnivore.weight carnivore.params["DeltaPhiMax"] = 0.1 herb = Herbivore(example_properties) herb.find_fitness() carnivore.attempt_eating_all_herbivores_in_cell([herb]) assert old_weight < carnivore.weight
def test_list_of_herbs_returned(self, example_properties, teardown_carnivore_tests): """ Asserts that eat method returns a list of herbivore class instances when the carnivore has eaten a herbivore. """ carnivore = Carnivore(example_properties) carnivore.find_fitness() carnivore.params["DeltaPhiMax"] = 0.1 herb = Herbivore(example_properties) herb.find_fitness() eaten_herbs = carnivore.attempt_eating_all_herbivores_in_cell([herb]) assert type(eaten_herbs) is list