check optiondescription's type

This commit is contained in:
egarette@silique.fr 2023-02-27 12:32:40 +01:00
parent 477b0a2da1
commit ba0634f163
2 changed files with 5 additions and 1 deletions

View file

@ -436,6 +436,7 @@ async def test_config_od_type(config_type):
o2 = OptionDescription('val', '', [o]) o2 = OptionDescription('val', '', [o])
async with await Config(o2) as cfg: async with await Config(o2) as cfg:
cfg = await get_config(cfg, config_type) cfg = await get_config(cfg, config_type)
assert await cfg.option('val').option.type() == 'optiondescription'
assert await cfg.option('val.i').option.type() == 'integer' assert await cfg.option('val.i').option.type() == 'integer'
assert not await list_sessions() assert not await list_sessions()

View file

@ -407,6 +407,8 @@ class TiramisuOptionOption(_TiramisuOptionOptionDescription):
@option_and_connection @option_and_connection
async def type(self): async def type(self):
if self._option_bag.option.impl_is_optiondescription():
return 'optiondescription'
return self._option_bag.option.get_type() return self._option_bag.option.get_type()
@option_and_connection @option_and_connection
@ -699,7 +701,8 @@ class TiramisuOptionValue(CommonTiramisuOption):
flatten=False, flatten=False,
withwarning: bool=False, withwarning: bool=False,
fullpath=False, fullpath=False,
leader_to_list=False): leader_to_list=False,
):
"""Dict with path as key and value""" """Dict with path as key and value"""
name = self._option_bag.option.impl_getname() name = self._option_bag.option.impl_getname()
subconfig = await self._subconfig.get_subconfig(self._option_bag) subconfig = await self._subconfig.get_subconfig(self._option_bag)