예제 #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
예제 #2
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)
예제 #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)
예제 #4
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