def test_procreation(self, mocker): herb = Herbivore(4, 30) herb_born = herb.procreation(1) assert herb_born is None carn = Carnivore(4, 30) carn_born = carn.procreation(1) assert carn_born is None herb = Herbivore(4, 30) weight = herb.weight lose_weight = ( herb.params_dict["zeta"] * (herb.params_dict["w_birth"] + herb.params_dict["sigma_birth"])) assert weight < lose_weight for _ in range(10): procreation = herb.procreation(10) assert procreation is None herb = Herbivore(5, 40) phi = herb.phi mocker.patch('random.random', return_value=0.0001) herb.procreation(2) mocker.patch('random.gauss', return_value=5) herb.weight = 40 - (herb.params_dict["xi"] * herb.get_initial_weight_offspring()) phi_procreated = herb.phi assert herb.weight == 34 # NOT WORKING CHECK IT OUT!!!! assert phi > phi_procreated
def test_weight(): """Tests that it is possible to set and get weight of an animal.""" herb = Herbivore(10, 20) carn = Carnivore(10, 20) assert herb.weight == 20 assert carn.weight == 20 herb.weight = 30 carn.weight = 30 assert herb.weight == 30 assert carn.weight == 30