Back to index

python-biopython  1.60
Static Public Attributes | Private Member Functions
test_GAMutation.MutationHelper Class Reference
Inheritance diagram for test_GAMutation.MutationHelper:
Inheritance graph
[legend]

List of all members.

Static Public Attributes

int num_trials = 500

Private Member Functions

def _always_mutate
def _never_mutate

Detailed Description

Mixin class which provides useful functions for testing mutations.

Definition at line 29 of file test_GAMutation.py.


Member Function Documentation

def test_GAMutation.MutationHelper._always_mutate (   self,
  mutator,
  expected_percent 
) [private]
Test the ability of a mutator to always mutate.

Arguments:

o mutator - The mutation class we're testing.

o expected_percent - The minimum percent of mutations we expect
to see under 'always mutate.' This will depend on how many letters
are in the alphabet and other factors.

Definition at line 34 of file test_GAMutation.py.

00034 
00035     def _always_mutate(self, mutator, expected_percent):
00036         """Test the ability of a mutator to always mutate.
00037 
00038         Arguments:
00039 
00040         o mutator - The mutation class we're testing.
00041 
00042         o expected_percent - The minimum percent of mutations we expect
00043         to see under 'always mutate.' This will depend on how many letters
00044         are in the alphabet and other factors.
00045         """
00046         num_mutations = 0
00047         for trial in range(self.num_trials):
00048             new_org = mutator.mutate(self.organism)
00049 
00050             # if we see a visilble mutation, mark it down
00051             if new_org != self.organism:
00052                 num_mutations += 1
00053 
00054         percent_mutants = float(num_mutations) / float(self.num_trials)
00055         assert percent_mutants > expected_percent, \
00056                "Did not recieve an acceptable number of mutations."

Here is the call graph for this function:

Here is the caller graph for this function:

def test_GAMutation.MutationHelper._never_mutate (   self,
  mutator 
) [private]
Test that a mutator does not cause unexpected mutations.

Definition at line 57 of file test_GAMutation.py.

00057 
00058     def _never_mutate(self, mutator):
00059         """Test that a mutator does not cause unexpected mutations.
00060         """
00061         for trial in range(self.num_trials):
00062             new_org = mutator.mutate(self.organism)
00063             assert new_org == self.organism, "Unexpected mutation found"

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 32 of file test_GAMutation.py.


The documentation for this class was generated from the following file: