def test_make_child_returns_individual(self): """ call the make child method, and assert that the returned type is of type individual. """ myPair = Pair( self.I1, self.I2 ) child = myPair.make_child(delta = 0.5) self.assertIsInstance(child, Individual)
def test_make_child_return_sensible_genes(self): """ Use an extreme case to test that make child is not doing something silly. """ I1 = Individual(1,1,1,1) I2 = Individual(0,0,0,0) myPair = Pair(I1,I2) ##Repeat a few time to be safe for _ in range(64): child = myPair.make_child(delta = 0.5, mu_strat = 0, mu_assort = 0) ##The child must have an a value of 1 and one of 0 and likewise for m self.assertEqual( child.a1 + child.a2, 1 ) self.assertEqual( child.m1 + child.m2, 1 )