def test_death_probability(mocker):
    """Test that the death function returns true if the mocked value is lower than the probability
    of death. Also the opposite if the mocked value is higher than the probability of death."""
    mocker.patch("numpy.random.random", return_value=0)
    herb = Herbivore(5, 10)
    carn = Carnivore(6, 15)
    assert herb.death() is True
    assert carn.death() is True

    mocker.patch("numpy.random.random", return_value=1)
    herb = Herbivore(5, 10)
    carn = Carnivore(6, 15)
    assert herb.death() is False
    assert carn.death() is False
def test_death_weight():
    """Testing that the animal dies if the weight is 0."""
    herb = Herbivore(3, 0)
    carn = Carnivore(5, 0)

    assert herb.death() is True
    assert carn.death() is True