示例#1
0
 def test_correct_prob_death(self, example_properties_w_20):
     """
     Asserts that prob_death calculates the correct probability of dying.
     """
     animal = Animal(example_properties_w_20)
     animal.find_fitness()
     assert animal.prob_death() == approx(0.0014929212599999687)
示例#2
0
 def test_prob_death_is_one_if_fitness_zero(self, example_properties_w_20):
     """
     Asserts that the probability calculated from prob_death is one
     if fitness equals zero.
     """
     animal = Animal(example_properties_w_20)
     animal.weight = 0
     animal.find_fitness()
     assert animal.prob_death() == 1