calc_value with join parameter now work if an option is empty
This commit is contained in:
@ -1433,11 +1433,14 @@ async def test_calc_value_remove_duplicate(config_type):
|
||||
async def test_calc_value_join(config_type):
|
||||
val1 = StrOption('val1', "", 'val1')
|
||||
val2 = StrOption('val2', "", 'val2')
|
||||
val3 = StrOption('val3', "", Calculation(calc_value, Params((ParamOption(val1), ParamOption(val2)), join=ParamValue('.'))))
|
||||
od = OptionDescription('root', '', [val1, val2, val3])
|
||||
val3 = StrOption('val3', "")
|
||||
val4 = StrOption('val4', "", Calculation(calc_value, Params((ParamOption(val1), ParamOption(val2), ParamOption(val3)), join=ParamValue('.'))))
|
||||
od = OptionDescription('root', '', [val1, val2, val3, val4])
|
||||
async with await Config(od) as cfg:
|
||||
cfg = await get_config(cfg, config_type)
|
||||
assert await cfg.value.dict() == {'val1': 'val1', 'val2': 'val2', 'val3': 'val1.val2'}
|
||||
assert await cfg.value.dict() == {'val1': 'val1', 'val2': 'val2', 'val3': None, 'val4': None}
|
||||
await cfg.option('val3').value.set('val3')
|
||||
assert await cfg.value.dict() == {'val1': 'val1', 'val2': 'val2', 'val3': 'val3', 'val4': 'val1.val2.val3'}
|
||||
assert not await list_sessions()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user