44 lines
1.5 KiB
Python
44 lines
1.5 KiB
Python
from .autopath import do_autopath
|
|
do_autopath()
|
|
from tiramisu import BoolOption, StrOption, SymLinkOption, OptionDescription, DynOptionDescription, \
|
|
Calculation, Params, ParamOption, ParamValue, calc_value, Config
|
|
from pickle import dumps
|
|
import pytest
|
|
import sys, warnings
|
|
|
|
|
|
def test_diff_opt():
|
|
b = BoolOption('b', '')
|
|
disabled_property = Calculation(calc_value,
|
|
Params(ParamValue('disabled'),
|
|
kwargs={'condition': ParamOption(b),
|
|
'expected': ParamValue(True),
|
|
'reverse_condition': ParamValue(True)}))
|
|
u = StrOption('u', '', properties=(disabled_property,))
|
|
s = SymLinkOption('s', u)
|
|
o = OptionDescription('o', '', [b, u, s])
|
|
o1 = OptionDescription('o1', '', [o])
|
|
|
|
with pytest.raises(NotImplementedError):
|
|
dumps(o1)
|
|
|
|
|
|
def test_diff_information_config():
|
|
b = BoolOption('b', '')
|
|
b.impl_set_information('info', 'oh')
|
|
b.impl_set_information('info1', 'oh')
|
|
b.impl_set_information('info2', 'oh')
|
|
o = OptionDescription('o', '', [b])
|
|
od1 = OptionDescription('o1', '', [o])
|
|
cfg = Config(od1)
|
|
c = cfg._config_bag.context
|
|
with pytest.raises(NotImplementedError):
|
|
dumps(c)
|
|
# assert not list_sessions()
|
|
|
|
|
|
def test_only_optiondescription():
|
|
b = BoolOption('b', '')
|
|
b
|
|
with pytest.raises(NotImplementedError):
|
|
dumps(b)
|