Пример #1
0
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"])
Пример #2
0
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)
Пример #3
0
def test_double_parameter_valid_step_size(step_size):
    DoubleParameter(default_value=1, lower=0, upper=10, step_size=step_size)
Пример #4
0
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'])
Пример #5
0
def test_double_parameter_valid_default_value(value):
    DoubleParameter(default_value=value, lower=0, upper=5)
Пример #6
0
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'])
Пример #7
0
def test_double_parameter_valid_upper_lower_limits(limits):
    DoubleParameter(default_value=5, lower=limits[0], upper=limits[1])
Пример #8
0
def double_param():
    return DoubleParameter(default_value=2.5, lower=1, upper=10)