Back to index

python-biopython  1.60
Classes | Functions | Variables
test_GASelection Namespace Reference

Classes

class  TestAlphabet
class  NoSelection
class  NoMutation
class  NoCrossover
class  NoRepair
class  DiversitySelectionTest
class  TournamentSelectionTest
class  RouletteWheelSelectionTest

Functions

def test_fitness
def random_genome
def random_organism

Variables

tuple runner = unittest.TextTestRunner(verbosity = 2)

Function Documentation

Return a random genome string.

Definition at line 60 of file test_GASelection.py.

00060 
00061 def random_genome():
00062     """Return a random genome string.
00063     """
00064     alphabet = TestAlphabet()
00065 
00066     new_genome = ""
00067     for letter in range(3):
00068         new_genome += random.choice(alphabet.letters)
00069 
00070     return MutableSeq(new_genome, alphabet)

Here is the caller graph for this function:

Generate a random organism.

Definition at line 71 of file test_GASelection.py.

00071 
00072 def random_organism():
00073     """Generate a random organism.
00074     """
00075     genome = random_genome()
00076     return Organism(genome, test_fitness)
00077 
00078 # --- the actual test classes

Here is the call graph for this function:

Here is the caller graph for this function:

Simple class for calculating fitnesses.

Definition at line 30 of file test_GASelection.py.

00030 
00031 def test_fitness(genome):
00032     """Simple class for calculating fitnesses.
00033     """
00034     genome_seq = genome.toseq()
00035     return int(genome_seq.tostring())


Variable Documentation

tuple test_GASelection.runner = unittest.TextTestRunner(verbosity = 2)

Definition at line 194 of file test_GASelection.py.