manage callback with unrestraint

This commit is contained in:
2021-03-08 06:39:40 +01:00
parent 2f173af70f
commit 200562d23c
3 changed files with 45 additions and 11 deletions

View File

@ -1298,6 +1298,21 @@ async def test_callback_calculating_invalid():
assert not await list_sessions()
@pytest.mark.asyncio
async def test_callback_unrestraint():
opt1 = IntOption('opt1', '', 1)
opt2 = IntOption('opt2', '', Calculation(return_value, Params(ParamOption(opt1))))
od1 = OptionDescription('od1', '', [opt1], properties=('disabled',))
od2 = OptionDescription('od2', '', [opt2])
maconfig = OptionDescription('rootconfig', '', [od1, od2])
async with await Config(maconfig) as cfg:
await cfg.property.read_write()
with pytest.raises(ConfigError):
await cfg.option('od2.opt2').value.get()
assert await cfg.unrestraint.option('od2.opt2').value.get() == 1
assert not await list_sessions()
@pytest.mark.asyncio
async def test_callback_calculating_disabled():
opt1 = BoolOption('opt1', '', properties=('disabled',))