Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
test_GACrossover.SinglePointTest Class Reference

List of all members.

Public Member Functions

def setUp
def test_basic_crossover

Public Attributes

 alphabet
 org_1
 org_2
 crossover

Detailed Description

Test simple point crossovers.

Definition at line 35 of file test_GACrossover.py.


Member Function Documentation

Definition at line 38 of file test_GACrossover.py.

00038 
00039     def setUp(self):
00040         self.alphabet = TestAlphabet()
00041         genome_1 = MutableSeq("11111", self.alphabet)
00042         self.org_1 = Organism(genome_1, test_fitness)
00043 
00044         genome_2 = MutableSeq("22222", self.alphabet)
00045         self.org_2 = Organism(genome_2, test_fitness)
00046         
00047         self.crossover  = SinglePointCrossover(1.0)

Test basic point crossover functionality.

Definition at line 48 of file test_GACrossover.py.

00048 
00049     def test_basic_crossover(self):
00050         """Test basic point crossover functionality.
00051         """
00052         start_genome_1 = self.org_1.genome[:]
00053         start_genome_2 = self.org_2.genome[:]
00054         
00055         new_org_1, new_org_2 = self.crossover.do_crossover(self.org_1,
00056                                                            self.org_2)
00057         self.assertNotEqual(str(new_org_1.genome), str(start_genome_1),
00058                             "Did not perform a crossover when expected.")
00059         self.assertNotEqual(str(new_org_2.genome), str(start_genome_2),
00060                             "Did not perform a crossover when expected.")
00061         
00062         self.assertNotEqual(str(new_org_1), str(self.org_1),
00063                             "Returned an exact copy of the original organism.")
00064         self.assertNotEqual(str(new_org_2), str(self.org_2),
00065                             "Returned an exact copy of the original organism.")


Member Data Documentation

Definition at line 39 of file test_GACrossover.py.

Definition at line 46 of file test_GACrossover.py.

Definition at line 41 of file test_GACrossover.py.

Definition at line 44 of file test_GACrossover.py.


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