fix: allow_dynoption in identifiers()
This commit is contained in:
parent
acca0bc040
commit
60e259fef2
2 changed files with 9 additions and 1 deletions
|
|
@ -515,6 +515,12 @@ def test_dyndescription_subdyn():
|
||||||
assert cfg.option('od.dod2val1.dodval1.st').type() == "string"
|
assert cfg.option('od.dod2val1.dodval1.st').type() == "string"
|
||||||
assert cfg.option('od.dod2.dod').type() == "optiondescription"
|
assert cfg.option('od.dod2.dod').type() == "optiondescription"
|
||||||
assert cfg.option('od.dod2val1.dodval1').type() == "optiondescription"
|
assert cfg.option('od.dod2val1.dodval1').type() == "optiondescription"
|
||||||
|
#
|
||||||
|
with pytest.raises(AttributeOptionError):
|
||||||
|
cfg.option('od.dod2.dod').identifiers()
|
||||||
|
assert cfg.option('od.dod2.dod').identifiers(only_self=True) == ['val1', 'val2']
|
||||||
|
assert cfg.option('od.dod2val1.dodval1').identifiers() == ['val1', 'val1']
|
||||||
|
assert cfg.option('od.dod2val1.dodval1').identifiers(only_self=True) == ['val1', 'val2']
|
||||||
|
|
||||||
|
|
||||||
def test_callback_dyndescription_subdyn():
|
def test_callback_dyndescription_subdyn():
|
||||||
|
|
|
||||||
|
|
@ -521,7 +521,7 @@ class _TiramisuOptionOptionDescription:
|
||||||
)
|
)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
@option_type(["dynamic", "with_or_without_index"])
|
@option_type(["dynamic", "with_or_without_index", "allow_dynoption"])
|
||||||
def identifiers(
|
def identifiers(
|
||||||
self,
|
self,
|
||||||
only_self: bool = False,
|
only_self: bool = False,
|
||||||
|
|
@ -529,6 +529,8 @@ class _TiramisuOptionOptionDescription:
|
||||||
):
|
):
|
||||||
"""Get identifiers for dynamic option"""
|
"""Get identifiers for dynamic option"""
|
||||||
if not only_self:
|
if not only_self:
|
||||||
|
if self._subconfig.is_dynamic_without_identifiers and not uncalculated:
|
||||||
|
raise AttributeOptionError(self._subconfig.path, "option-dynamic")
|
||||||
return self._subconfig.identifiers
|
return self._subconfig.identifiers
|
||||||
if (
|
if (
|
||||||
not self._subconfig.option.impl_is_optiondescription()
|
not self._subconfig.option.impl_is_optiondescription()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue