Exemple #1
0
def test_valid_check_init_random_population():
    ga = BinaryGA(list(range(5)), fitness_test_func)

    max_num = ga._check_init_random_population(15)
    assert max_num == 2**5
def test_invalid_check_init_random_population(size):
    ga = BinaryGA(list(range(5)), fitness_test_func)

    with pytest.raises(ValueError):
        ga._check_init_random_population(size)
Exemple #3
0
def test_invalid_check_init_random_population(size):
    ga = BinaryGA(list(range(5)), fitness_test_func)

    with pytest.raises(ValueError):
        ga._check_init_random_population(size)
def test_valid_check_init_random_population():
    ga = BinaryGA(list(range(5)), fitness_test_func)

    max_num = ga._check_init_random_population(15)
    assert max_num == 2**5