rougail/tests/dictionaries/04_7validators_variable_optional/tiramisu/base.py

14 lines
1.7 KiB
Python

from tiramisu import *
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
load_functions('tests/dictionaries/../eosfunc/test.py')
ALLOWED_LEADER_PROPERTIES.add("basic")
ALLOWED_LEADER_PROPERTIES.add("standard")
ALLOWED_LEADER_PROPERTIES.add("advanced")
dict_env['validators_rougail.general.int'] = "{% if _.int == int2 %}\nint and int2 must be different\n{% endif %}\n"
dict_env['validators_rougail.general.int_0'] = "{% if _.int == int3 %}\nint and int3 must be different\n{% endif %}\n"
option_4 = IntOption(name="int2", doc="a second number", default=1, properties=frozenset({"mandatory", "standard"}), informations={'type': 'number'})
option_3 = IntOption(name="int", doc="a first number", validators=[Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_rougail.general.int"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), 'int2': ParamOption(option_4), '_.int': ParamSelfOption(whole=False)})), Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_rougail.general.int_0"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '_.int': ParamSelfOption(whole=False)}))], properties=frozenset({"basic", "mandatory"}), informations={'type': 'number'})
optiondescription_2 = OptionDescription(name="general", doc="a family", children=[option_3, option_4], properties=frozenset({"basic"}))
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", children=[optiondescription_2], properties=frozenset({"basic"}))
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])