Example #1
0
 def test_mutation_rate_constant_in_range(self, fake_random):
     fake_random.random.return_value = options.mutation_rate * 0.9
     g1 = Constant(10)
     g2 = g1.reproduce()
     self.assertNotEqual(g1, g2)
     self.assertGreaterEqual(10 + options.constant_mutation_depth, g2.value)
     self.assertLessEqual(10 - options.constant_mutation_depth, g2.value)
Example #2
0
 def test_mutation_rate_trigger(self, fake_random):
     fake_random.random.return_value = options.mutation_rate * 0.9
     g1 = Constant(10)
     g2 = g1.reproduce()
     self.assertNotEqual(g1.value, g2.value)