def test_double_parameter_invalid_step_size(step_size): with pytest.raises(ValueError) as e: DoubleParameter(default_value=1, lower=0, upper=10, step_size=step_size) assert_terms_in_exception(e, ["invalid", "step"])
class TestOperator(Operator): def run(self, img: Image, ctx: PipelineContext) -> Image: return img + 1 param1 = IntegerParameter(default_value=PARAM1_DEFAULT_VALUE, lower=PARAM1_LOWER, upper=PARAM1_UPPER) param2 = DoubleParameter(default_value=PARAM2_DEFAULT_VALUE, lower=PARAM2_LOWER, upper=PARAM2_UPPER)
def test_double_parameter_valid_step_size(step_size): DoubleParameter(default_value=1, lower=0, upper=10, step_size=step_size)
def test_double_parameter_invalid_default_value(value): with pytest.raises(ValueError) as e: DoubleParameter(default_value=value, lower=0, upper=5) assert_terms_in_exception(e, ['invalid', 'default'])
def test_double_parameter_valid_default_value(value): DoubleParameter(default_value=value, lower=0, upper=5)
def test_double_parameter_invalid_lower_upper_limits(limits): with pytest.raises(ValueError) as e: DoubleParameter(default_value=5, lower=limits[0], upper=limits[1]) assert_terms_in_exception(e, ['invalid'])
def test_double_parameter_valid_upper_lower_limits(limits): DoubleParameter(default_value=5, lower=limits[0], upper=limits[1])
def double_param(): return DoubleParameter(default_value=2.5, lower=1, upper=10)