def test_halt_function(self):
        """
        Ensures that the halt function is called for all subsequent yields
        after yielding the starting population.
        """
        start_pop = [1, 2, 3]

        def fitness(genome):
            """
            For illustrative purposes.
            """
            return genome

        def halt(population, generation_count):
            """
            Halts the algorithm after ten populations.
            """
            return generation_count >= 10

        class Generate(object):
            """
            As simple as possible. See generate related test below.
            """
            def __init__(self, parents):
                pass

            def __iter__(self):
                return self

            def next(self):
                raise StopIteration()

        ga = genetic_algorithm(start_pop, fitness, Generate, halt)
        result = [p for p in ga]
        actual = len(result)
        expected = 10
        self.assertEqual(actual, expected,
            "Actual: %r Expected: %r" % (actual, expected))
dataset/ETHPy150Open ntoll/foox/test/test_ga.py/TestGeneticAlgorithm.test_halt_function/operator `==` -> `>=`