Logo Search packages:      
Sourcecode: python-biopython version File versions  Download package

def test_GAMutation::SafeFitnessTest::t_keep_new (   self  ) 

Make sure we always keep the new organism when specified.

Definition at line 184 of file test_GAMutation.py.

00184                         :
        """Make sure we always keep the new organism when specified.
        """
        mutator = SafeFitnessMutation(self.test_mutator, 1.0)

        self.test_mutator.type = "same"
        new_org = mutator.mutate(self.org)
        assert (new_org == self.org), \
               "Did not retain organism for same fitness."

        self.test_mutator.type = "lower"
        new_org = mutator.mutate(self.org)
        assert (new_org.fitness < self.org.fitness), \
               "Did not get new organism when it had lower fitness."

        self.test_mutator.type = "higher"
        new_org = mutator.mutate(self.org)
        assert (new_org.fitness > self.org.fitness), \
                "Did not get new organism under higher fitness conditions."

if __name__ == "__main__":


Generated by  Doxygen 1.6.0   Back to index