def test_can_birth_occur_with_1_herbivore(self): """Test to see that birth will not occur for only 1 animal """ loc = (2, 7) i_sim = Island() a_sim = Herbivore(i_sim, loc) i_sim.add_pop_on_loc(loc, a_sim) assert not a_sim.can_birth_occur()
def test_can_birth_occur_with_2_herbivores_with_0_prob(self, mocker): """Test to show that 2 herbivores will not give birth if the probability is mocked to highest possible value. """ mocker.patch('random.random', return_value=1) loc = (2, 7) i_sim = Island() a_sim = Herbivore(i_sim, loc, weight=100) for _ in range(2): i_sim.add_pop_on_loc(loc, a_sim) assert not a_sim.can_birth_occur()