2 from .autopath import do_autopath
5 from tiramisu.config import Config, GroupConfig, MetaConfig
6 from tiramisu.option import BoolOption, IntOption, StrOption, OptionDescription, submulti
13 def test_deref_storage():
14 b = BoolOption('b', '')
15 o = OptionDescription('od', '', [b])
17 w = weakref.ref(c.cfgimpl_get_values()._p_)
22 def test_deref_value():
23 b = BoolOption('b', '')
24 o = OptionDescription('od', '', [b])
26 w = weakref.ref(c.cfgimpl_get_values())
31 def test_deref_setting():
32 b = BoolOption('b', '')
33 o = OptionDescription('od', '', [b])
35 w = weakref.ref(c.cfgimpl_get_settings())
40 def test_deref_config():
41 b = BoolOption('b', '')
42 o = OptionDescription('od', '', [b])
49 def test_deref_option():
51 b = BoolOption('b', '')
52 o = OptionDescription('od', '', [b])
56 assert w() is not None
57 except AssertionError:
64 def test_deref_optiondescription():
67 b = BoolOption('b', '')
68 o = OptionDescription('od', '', [b])
71 assert w() is not None
76 def test_deref_option_cache():
79 b = BoolOption('b', '')
80 o = OptionDescription('od', '', [b])
81 o.impl_build_cache_option()
84 assert w() is not None
89 def test_deref_optiondescription_cache():
92 b = BoolOption('b', '')
93 o = OptionDescription('od', '', [b])
94 o.impl_build_cache_option()
97 assert w() is not None
102 def test_deref_option_config():
105 b = BoolOption('b', '')
106 o = OptionDescription('od', '', [b])
110 assert w() is not None
112 assert w() is not None
117 def test_deref_optiondescription_config():
120 b = BoolOption('b', '')
121 o = OptionDescription('od', '', [b])
125 assert w() is not None
127 assert w() is not None
132 def test_deref_groupconfig():
135 i1 = IntOption('i1', '')
136 od1 = OptionDescription('od1', '', [i1])
137 od2 = OptionDescription('od2', '', [od1])
138 conf1 = Config(od2, 'conf1')
139 conf2 = Config(od2, 'conf2')
140 meta = GroupConfig([conf1, conf2])
141 w = weakref.ref(conf1)
143 assert w() is not None
148 def test_deref_metaconfig():
151 i1 = IntOption('i1', '')
152 od1 = OptionDescription('od1', '', [i1])
153 od2 = OptionDescription('od2', '', [od1])
154 conf1 = Config(od2, 'conf1')
155 conf2 = Config(od2, 'conf2')
156 meta = MetaConfig([conf1, conf2])
157 w = weakref.ref(conf1)
159 assert w() is not None
164 def test_deref_submulti():
167 multi = StrOption('multi', '', multi=submulti)
168 od = OptionDescription('od', '', [multi])
170 cfg.cfgimpl_get_settings().remove('cache')
171 w = weakref.ref(cfg.multi)
174 w = weakref.ref(cfg.multi)
178 z = weakref.ref(w()[0])