From ba0634f163953d40b103c6d6e1ad1d40e273fc21 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Mon, 27 Feb 2023 12:32:40 +0100 Subject: [PATCH] check optiondescription's type --- tests/test_config.py | 1 + tiramisu/api.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_config.py b/tests/test_config.py index d7164c0..b6f3138 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -436,6 +436,7 @@ async def test_config_od_type(config_type): o2 = OptionDescription('val', '', [o]) async with await Config(o2) as cfg: 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 not await list_sessions() diff --git a/tiramisu/api.py b/tiramisu/api.py index e57b1ce..ec3ff58 100644 --- a/tiramisu/api.py +++ b/tiramisu/api.py @@ -407,6 +407,8 @@ class TiramisuOptionOption(_TiramisuOptionOptionDescription): @option_and_connection async def type(self): + if self._option_bag.option.impl_is_optiondescription(): + return 'optiondescription' return self._option_bag.option.get_type() @option_and_connection @@ -699,7 +701,8 @@ class TiramisuOptionValue(CommonTiramisuOption): flatten=False, withwarning: bool=False, fullpath=False, - leader_to_list=False): + leader_to_list=False, + ): """Dict with path as key and value""" name = self._option_bag.option.impl_getname() subconfig = await self._subconfig.get_subconfig(self._option_bag)