Closed JJ closed 4 years ago
The second error is:
def test_crossover_two_points_7():
"""Test crossover function"""
# We initialize the seed to get always the same random numbers
random.seed(0)
individual1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
individual2 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
expected_result = [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1]
result = genetic.crossover_two_points(individual1, individual2)
> assert(result == expected_result)
E assert [1, 1, 1, 1, 1, 1, ...] == [1, 1, 1, 1, 1, 1, ...]
E At index 10 diff: 0 != 1
E Full diff:
E - [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0]
E ? ^ ^ ^
E + [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1]
E ? ^ ^ ^
It might not be actually working as a 2-point crossover.
In
test_genetic.py
: