def test_invalid_bin_length(): ga = RealGA(fitness_test_sin_func) ga._bin_length = 128 with pytest.raises(ValueError): ga._check_parameters()
def test_invalid_get_mut_bit_offset(): ga = RealGA(fitness_test_sin_func) ga._bin_length = 128 with pytest.raises(ValueError): ga._get_mut_bit_offset()
def test_valid_get_mut_bit_offset(bin_length, result): ga = RealGA(fitness_test_sin_func) ga._bin_length = bin_length assert ga._get_mut_bit_offset() == result