tiramisu/test/test_multi.py

24 lines
659 B
Python
Raw Normal View History

2014-02-02 18:21:09 +01:00
# coding: utf-8
2015-07-24 17:54:10 +02:00
from autopath import do_autopath
do_autopath()
2014-02-02 18:21:09 +01:00
from tiramisu.value import Multi
from tiramisu.option import IntOption, OptionDescription
from tiramisu.config import Config
from tiramisu.error import ConfigError
import weakref
from py.test import raises
def test_multi():
i = IntOption('int', '', multi=True)
o = OptionDescription('od', '', [i])
c = Config(o)
2015-07-24 17:54:10 +02:00
multi = Multi([1, 2, 3], weakref.ref(c), i, 'int')
2014-02-02 18:21:09 +01:00
raises(ValueError, "Multi([1,2,3], c, i, 'int')")
raises(ValueError, "Multi(multi, weakref.ref(c), i, 'int')")
assert c is multi._getcontext()
del(c)
raises(ConfigError, "multi._getcontext()")