Exemple #1
0
 def test_true_if_death_prob_is_zero(self, example_properties_w_40):
     """
     Assert that will_animal_live returns True if probability of dying
     is zero because of high fitness.
     """
     numpy.random.seed(1)
     animal = Animal(example_properties_w_40)
     assert animal.will_animal_live() is True
Exemple #2
0
 def test_not_true_if_death_prob_is_one(self, example_properties_w_20):
     """
     Assert that will_animal_live does not return True if probability of
     dying is one.
     """
     animal = Animal(example_properties_w_20)
     animal.weight = 0
     animal.find_fitness()
     assert animal.will_animal_live() is not True
Exemple #3
0
 def test_true_if_rand_num_more_than_death_prob(self,
                                                example_properties_w_20,
                                                mocker):
     """
     Asserts that will_animal_live returns True if the random number is
     larger than the death probability.
     """
     mocker.patch('numpy.random.random', return_value=0.5)
     animal = Animal(example_properties_w_20)
     animal.find_fitness()
     assert animal.will_animal_live() is True