Example #1
0
 class AutoCast(Constants):
     __antidote__ = Constants.Conf(auto_cast=True)
     A = const[int]('109')
     B = const[float]('3.14')
     C = const[str](199)
Example #2
0
 class LimitedAutoCast(Constants):
     __antidote__ = Constants.Conf(auto_cast=[int, float])
     A = const[int]('109')
     B = const[float]('3.14')
     C = const[str](199)
Example #3
0
def test_conf_repr():
    conf = Constants.Conf()
    assert "auto_cast" in repr(conf)
Example #4
0
def test_conf_copy(kwargs):
    conf = Constants.Conf().copy(**kwargs)
    for k, v in kwargs.items():
        assert getattr(conf, k) == v
Example #5
0
def test_conf_error(kwargs, expectation):
    with expectation:
        Constants.Conf(**kwargs)
Example #6
0
 class Config(Constants):
     __antidote__ = Constants.Conf(auto_cast=[MetaDummy])
     INVALID = const[int]('109')
     INVALID_CAST = const[MetaDummy]('x')
Example #7
0
 class ImpossibleCast(Constants):
     __antidote__ = Constants.Conf(auto_cast=[MetaDummy])
     A = const[MetaDummy]('x')