Пример #1
0
def test_parameter_arg_errors():
    with pytest.raises(ValueError, match="'name' must be a string"):
        params.Parameter(123, default=None)  # not string

    with pytest.raises(ValueError, match="'optional' must be boolean"):
        params.Parameter("o", default=None, optional="NotABool")

    with pytest.raises(ValueError, match="'readonly' must be boolean"):
        params.Parameter("o", default=None, readonly="NotABool")
Пример #2
0
 class Test(object):
     p = params.Parameter('p', default=1, readonly=False)
     r = params.Parameter('r', default=None, readonly=True)
Пример #3
0
 class Test(object):
     m = params.Parameter('m', default=1, optional=False)
     o = params.Parameter('o', default=1, optional=True)
Пример #4
0
 class Test(object):
     p = params.Parameter('p', default=1)
Пример #5
0
 class Test:
     param = params.Parameter("param", default=None)
Пример #6
0
 class Test:
     o = params.Parameter("o", default=None)
Пример #7
0
 class Test:
     p = params.Parameter("something", params.Unconfigurable)
Пример #8
0
def test_parameter_set_default_error():
    """Tests params set_default ConfigError"""
    my_param = params.Parameter("something")
    with pytest.raises(ConfigError, match="Parameter.*is not configurable"):
        params.Parameter.set_default(my_param, my_param, my_param)
Пример #9
0
 class Test:
     p = params.Parameter("p", default=1, readonly=False)
     r = params.Parameter("r", default=None, readonly=True)
Пример #10
0
 class Test:
     m = params.Parameter("m", default=1, optional=False)
     o = params.Parameter("o", default=1, optional=True)
Пример #11
0
 class Test:
     p = params.Parameter("p", default=1)
Пример #12
0
 class Test(object):
     p = params.Parameter(default=1, readonly=True)
Пример #13
0
 class Test:
     p = params.Parameter('p', default=1)