def test_integer_parameter_invalid_step_size(step_size): with pytest.raises(ValueError) as e: IntegerParameter(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_integer_parameter_invalid_lower_upper_limits(limits): with pytest.raises(ValueError) as e: IntegerParameter(default_value=5, lower=limits[0], upper=limits[1]) assert_terms_in_exception(e, ['invalid'])
def integer_param(): return IntegerParameter(default_value=10, lower=5, upper=15)
def test_integer_parameter_valid_lower_upper_limits(limits): IntegerParameter(default_value=5, lower=limits[0], upper=limits[1])
def test_integer_parameter_valid_step_size(step_size): IntegerParameter(default_value=1, lower=0, upper=10, step_size=step_size)
def test_integer_parameter_invalid_default_value(default_value): with pytest.raises(ValueError) as e: IntegerParameter(default_value=default_value, lower=0, upper=10) assert_terms_in_exception(e, ['invalid', 'default'])
def test_integer_parameter_valid_default_value(default_value): IntegerParameter(default_value=default_value, lower=0, upper=10)