def test_halt_function(self):
        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))
Return True if graph is directed, False otherwise.
dataset/ETHPy150Open ntoll/foox/test/test_ga.py/TestGeneticAlgorithm.test_halt_function--crossover with--dataset/ETHPy150Open networkx/networkx/networkx/classes/tests/timingclasses.py/TimingMultiGraph.is_directed