示例#1
0
def test_default_to_zero(mock_env):
    p = param.Int(default=0)
    value = p("LOG_LEVEL")
    assert value is not None
    assert value == 0
示例#2
0
def test_invalid_type_error_int(mock_env):
    with pytest.raises(ValueError):
        p = param.Int()
        value = p("THIS_ONE")
示例#3
0
def test_param_public_type():
    integer = param.Int()
    assert integer.type == "Int"
示例#4
0
def test_type_mapping_int(mock_env):
    integer = param.Int()
    value = integer("NUMBER")
    assert value == 60
    assert type(value) is int
示例#5
0
class EnvTestConfig(EnvConfig):

    TEST_VAR = param.Int(default=45)
    NEW_VAR = param.Str(override="SET_THIS_VAR")
示例#6
0
 class ErrConf(EnvConfig):
     THIS_ONE = param.Int(required=True)
示例#7
0
class DefaultAppConfig(EnvConfig):
    """App env config."""

    HOST = param.Str(required=True)
    PORT = param.Int(required=True)
    PASSWORD = param.Str(override="SECRET_REDIS_PW", required=True)
示例#8
0
class AppConfig(DefaultAppConfig):

    SERVICE = param.Str(prefix="MY_APP_")
    VERSION = param.Int(default=1)
    ENV = param.Str(default="prod")
    REMOTE_HOST = param.Int(default=0)