

def test_fitness_called_for_starting_population(self):
    '\n        Ensures the fitness function is called on each initial genome before\n        yielding the starting population.\n        '
    start_pop = [1, 2, 3]
    mock_fitness = MagicMock(return_value=None)
    ga = genetic_algorithm(start_pop, mock_fitness, None, None)
    result = mock_fitness.next()
    self.assertEqual(len(start_pop), mock_fitness.call_count, 'Fitness function not called for each genome.')

dataset/ETHPy150Open ntoll/foox/test/test_ga.py TestGeneticAlgorithm.test_fitness_called_for_starting_population/VarMisuse@46/106 `ga`->`mock_fitness`