calculation with self information and symlink
This commit is contained in:
parent
897d4dd216
commit
4e1053bba9
2 changed files with 16 additions and 6 deletions
|
@ -9,7 +9,7 @@ do_autopath()
|
||||||
from .config import config_type, get_config, value_list, global_owner
|
from .config import config_type, get_config, value_list, global_owner
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from tiramisu import Config
|
from tiramisu import Config, Calculation, Params, ParamSelfInformation, calc_value
|
||||||
from tiramisu.i18n import _
|
from tiramisu.i18n import _
|
||||||
from tiramisu import Config, IntOption, FloatOption, ChoiceOption, \
|
from tiramisu import Config, IntOption, FloatOption, ChoiceOption, \
|
||||||
BoolOption, StrOption, SymLinkOption, OptionDescription, undefined
|
BoolOption, StrOption, SymLinkOption, OptionDescription, undefined
|
||||||
|
@ -217,6 +217,17 @@ def test_information_option_2():
|
||||||
# assert not list_sessions()
|
# assert not list_sessions()
|
||||||
|
|
||||||
|
|
||||||
|
def test_information_option_symlink():
|
||||||
|
i1 = IntOption('test1', '', Calculation(calc_value, Params(ParamSelfInformation('info'))), informations={'info': 'value'})
|
||||||
|
i2 = SymLinkOption('test2', i1)
|
||||||
|
od1 = OptionDescription('test', '', [i2, i1])
|
||||||
|
cfg = Config(od1)
|
||||||
|
# it's tuples
|
||||||
|
assert set(cfg.option('test1').information.list()) == {'info', 'doc'}
|
||||||
|
assert set(cfg.option('test2').information.list()) == {'info', 'doc'}
|
||||||
|
# assert not list_sessions()
|
||||||
|
|
||||||
|
|
||||||
def test_information_optiondescription():
|
def test_information_optiondescription():
|
||||||
od1 = make_description()
|
od1 = make_description()
|
||||||
cfg = Config(od1)
|
cfg = Config(od1)
|
||||||
|
|
|
@ -86,7 +86,7 @@ class CacheOptionDescription(BaseOption):
|
||||||
force_store_values,
|
force_store_values,
|
||||||
dependencies_information,
|
dependencies_information,
|
||||||
)
|
)
|
||||||
else:
|
elif not option.impl_is_symlinkoption():
|
||||||
informations = option.get_dependencies_information()
|
informations = option.get_dependencies_information()
|
||||||
if informations:
|
if informations:
|
||||||
for param in informations.pop(None):
|
for param in informations.pop(None):
|
||||||
|
@ -94,10 +94,9 @@ class CacheOptionDescription(BaseOption):
|
||||||
for information, options in option.get_dependencies_information().items():
|
for information, options in option.get_dependencies_information().items():
|
||||||
if None in options:
|
if None in options:
|
||||||
dependencies_information.setdefault(information, []).append(option)
|
dependencies_information.setdefault(information, []).append(option)
|
||||||
if not option.impl_is_symlinkoption():
|
properties = option.impl_getproperties()
|
||||||
properties = option.impl_getproperties()
|
if 'force_store_value' in properties:
|
||||||
if 'force_store_value' in properties:
|
force_store_values.append(option)
|
||||||
force_store_values.append(option)
|
|
||||||
if option.impl_is_readonly():
|
if option.impl_is_readonly():
|
||||||
raise ConflictError(_('duplicate option: {0}').format(option))
|
raise ConflictError(_('duplicate option: {0}').format(option))
|
||||||
if not self.impl_is_readonly() and display_name:
|
if not self.impl_is_readonly() and display_name:
|
||||||
|
|
Loading…
Reference in a new issue