Back to index

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

List of all members.

Public Member Functions

def setUp
def test_basic_asym_crossover

Public Attributes

 alphabet
 org_1
 org_2
 asym_crossover

Detailed Description

Test simple 2-point crossovers.

Definition at line 283 of file test_GACrossover.py.


Member Function Documentation

Definition at line 286 of file test_GACrossover.py.

00286 
00287     def setUp(self):
00288         self.alphabet = TestAlphabet()
00289         genome_1 = MutableSeq("11111111", self.alphabet)
00290         self.org_1 = Organism(genome_1, test_fitness)
00291 
00292         genome_2 = MutableSeq("22222222", self.alphabet)
00293         self.org_2 = Organism(genome_2, test_fitness)
00294         
00295         self.asym_crossover = TwoPointCrossover(1.0)

Test basic asymmetric 2-point crossover functionality.

Definition at line 296 of file test_GACrossover.py.

00296 
00297     def test_basic_asym_crossover(self):
00298         """Test basic asymmetric 2-point crossover functionality.
00299         """
00300         start_genome_1 = self.org_1.genome[:]
00301         start_genome_2 = self.org_2.genome[:]
00302         
00303         new_org_1, new_org_2 = self.asym_crossover.do_crossover(self.org_1,
00304                                                                 self.org_2)
00305 
00306         self.assertNotEqual(str(new_org_1.genome), str(start_genome_1),
00307                             "Did not perform a crossover when expected.")
00308         self.assertNotEqual(str(new_org_2.genome), str(start_genome_2),
00309                             "Did not perform a crossover when expected.")
00310 
00311         self.assertNotEqual(str(new_org_1), str(self.org_1),
00312                             "Returned an exact copy of the original organism.")
00313         self.assertNotEqual(str(new_org_2), str(self.org_2),
00314                             "Returned an exact copy of the original organism.")


Member Data Documentation

Definition at line 287 of file test_GACrossover.py.

Definition at line 294 of file test_GACrossover.py.

Definition at line 289 of file test_GACrossover.py.

Definition at line 292 of file test_GACrossover.py.


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