コード例 #1
0
def test_valid_get_bit_positions(number, result):
    ga = BinaryGA(list(range(10)), fitness_test_func)

    bin_repr = ga._get_bit_positions(number)

    assert len(bin_repr) == len(result)

    for bit in result:
        assert bit in bin_repr
コード例 #2
0
def test_valid_get_bit_positions(number, result):
    ga = BinaryGA(list(range(10)), fitness_test_func)

    bin_repr = ga._get_bit_positions(number)

    assert len(bin_repr) == len(result)

    for bit in result:
        assert bit in bin_repr
コード例 #3
0
def test_invalid_get_bit_positions():
    ga = BinaryGA(list(range(10)), fitness_test_func)

    with pytest.raises(ValueError):
        ga._get_bit_positions(-1)
コード例 #4
0
def test_invalid_get_bit_positions():
    ga = BinaryGA(list(range(10)), fitness_test_func)

    with pytest.raises(ValueError):
        ga._get_bit_positions(-1)