multiple option call (fixes #1)
This commit is contained in:
parent
7873910322
commit
5c0ac75c52
@ -98,6 +98,16 @@ def test_option_isoptiondescription():
|
||||
assert not cfg.option('od.test').option.isoptiondescription()
|
||||
|
||||
|
||||
def test_option_double():
|
||||
i = IntOption('test', '')
|
||||
od = OptionDescription('od1', '', [i])
|
||||
od = OptionDescription('od2', '', [od])
|
||||
od = OptionDescription('od3', '', [od])
|
||||
cfg = Config(od)
|
||||
assert cfg.option('od2.od1.test').value.get() is None
|
||||
assert cfg.option('od2').option('od1').option('test').value.get() is None
|
||||
|
||||
|
||||
def test_option_multi():
|
||||
IntOption('test', '', multi=True)
|
||||
IntOption('test', '', multi=True, default_multi=1)
|
||||
|
@ -203,6 +203,20 @@ class _TiramisuOptionOptionDescription(CommonTiramisuOption):
|
||||
settings.get_context_properties(),
|
||||
settings.get_context_properties())
|
||||
|
||||
def __call__(self,
|
||||
path: str,
|
||||
index: Optional[int]=None) -> 'TiramisuOption':
|
||||
"""Select an option by path"""
|
||||
subpath = self._option_bag.option.impl_getname() + '.' + path
|
||||
subconfig, name = self._subconfig.cfgimpl_get_home_by_path(subpath,
|
||||
self._option_bag.config_bag)
|
||||
path = self._option_bag.path + '.' + path
|
||||
return TiramisuOption(name,
|
||||
path,
|
||||
index,
|
||||
subconfig,
|
||||
self._option_bag.config_bag)
|
||||
|
||||
|
||||
class _TiramisuOptionOption(_TiramisuOptionOptionDescription):
|
||||
"""Manage option"""
|
||||
@ -738,17 +752,9 @@ class TiramisuOption(CommonTiramisuOption):
|
||||
subconfig=subconfig,
|
||||
config_bag=config_bag)
|
||||
|
||||
|
||||
#__________________________________________________________________________________________________
|
||||
#
|
||||
# First part of API:
|
||||
# - contexts informations:
|
||||
# - context owner
|
||||
# - context information
|
||||
# - context property
|
||||
# - context permissive
|
||||
# - forcepermissive
|
||||
# - unrestraint
|
||||
# - manage MetaConfig or GroupConfig
|
||||
|
||||
|
||||
class TiramisuContext(TiramisuHelp):
|
||||
|
Loading…
Reference in New Issue
Block a user