Example #1
0
def test_iter_cast(os_env):
    env = EnvWrapper(
        NUMBERS=EnvVar(postprocessor=EnvVar.tokenize(sep=','), sub_cast=float))
    os_env['NUMBERS'] = '0.1, 0.2, 0.3, 0.4'
    assert env.NUMBERS == [0.1, 0.2, 0.3, 0.4]
    d = env.collect()
    assert d['NUMBERS'] == os_env['NUMBERS']
Example #2
0
def test_iter_sub_cast(os_env):
    env = EnvWrapper(
        VALUES=EnvVar(postprocessor=EnvVar.tokenize(), sub_cast=int))
    os_env['VALUES'] = '1 2 3 4 5'
    assert env.VALUES == [1, 2, 3, 4, 5]