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
def test_invalid_get_bit_positions(): ga = BinaryGA(list(range(10)), fitness_test_func) with pytest.raises(ValueError): ga._get_bit_positions(-1)