Пример #1
0
    def test_always_mutate(self):
        """Test ability to cause mutations.
        """
        mutator = ConversionMutation(mutation_rate=1.0)

        # when we mutate randomly by chance, we expect to get 2/3
        # visible mutations (there are three letters in the alphabet and
        # one change cannot be observed since it is a mutation back to itself)
        # For a four letter genome, the chance of being exactly the same
        # after mutations is about .01, so being better than 90% different
        # if a reasonable expectation.
        expected_percent = .9

        self._always_mutate(mutator, expected_percent)
Пример #2
0
 def test_never_mutate(self):
     """Make sure we do not mutate at unexpected times.
     """
     mutator = ConversionMutation(mutation_rate=0.0)
     self._never_mutate(mutator)