diff --git a/tests/test_dyn_optiondescription.py b/tests/test_dyn_optiondescription.py index 407528d..d936874 100644 --- a/tests/test_dyn_optiondescription.py +++ b/tests/test_dyn_optiondescription.py @@ -515,6 +515,12 @@ def test_dyndescription_subdyn(): assert cfg.option('od.dod2val1.dodval1.st').type() == "string" assert cfg.option('od.dod2.dod').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(): diff --git a/tiramisu/api.py b/tiramisu/api.py index ddb2afd..8f96431 100644 --- a/tiramisu/api.py +++ b/tiramisu/api.py @@ -521,7 +521,7 @@ class _TiramisuOptionOptionDescription: ) return ret - @option_type(["dynamic", "with_or_without_index"]) + @option_type(["dynamic", "with_or_without_index", "allow_dynoption"]) def identifiers( self, only_self: bool = False, @@ -529,6 +529,8 @@ class _TiramisuOptionOptionDescription: ): """Get identifiers for dynamic option""" 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 if ( not self._subconfig.option.impl_is_optiondescription()