Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
test_GASelection.DiversitySelectionTest Class Reference

List of all members.

Public Member Functions

def setUp
def test_get_new_organism
def test_no_retrieve_organism
def test_selection

Public Attributes

 selector

Detailed Description

Test selection trying to maximize diversity.

Definition at line 79 of file test_GASelection.py.


Member Function Documentation

Definition at line 82 of file test_GASelection.py.

00082 
00083     def setUp(self):
00084         self.selector = DiversitySelection(NoSelection(), random_genome)

Getting a new organism not in the new population.

Definition at line 85 of file test_GASelection.py.

00085 
00086     def test_get_new_organism(self):
00087         """Getting a new organism not in the new population.
00088         """
00089         org = random_organism()
00090         old_pop = [org]
00091         new_pop = []
00092 
00093         new_org = self.selector._get_new_organism(new_pop, old_pop)
00094         self.assertEqual(new_org, org,
00095                          "Got an unexpected organism %s" % new_org)

Here is the call graph for this function:

Test not getting an organism already in the new population.

Definition at line 96 of file test_GASelection.py.

00096 
00097     def test_no_retrieve_organism(self):
00098         """Test not getting an organism already in the new population.
00099         """
00100         org = random_organism()
00101         old_pop = [org]
00102         new_pop = [org]
00103 
00104         new_org = self.selector._get_new_organism(new_pop, old_pop)
00105         #assert new_org != org, "Got organism already in the new population."
00106         #TODO - Why was the above commented out?

Here is the call graph for this function:

Test basic selection on a small population.

Definition at line 107 of file test_GASelection.py.

00107 
00108     def test_selection(self):
00109         """Test basic selection on a small population.
00110         """
00111         pop = [random_organism() for org_num in range(50)]
00112 
00113         new_pop = self.selector.select(pop)
00114 
00115         self.assertEqual(len(new_pop), len(pop),
00116                          "Did not maintain population size.")

Here is the call graph for this function:


Member Data Documentation

Definition at line 83 of file test_GASelection.py.


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