test for multi
authorEmmanuel Garette <egarette@cadoles.com>
Sun, 2 Feb 2014 17:21:09 +0000 (18:21 +0100)
committerEmmanuel Garette <egarette@cadoles.com>
Sun, 2 Feb 2014 17:21:09 +0000 (18:21 +0100)
test/test_multi.py [new file with mode: 0644]

diff --git a/test/test_multi.py b/test/test_multi.py
new file mode 100644 (file)
index 0000000..42fd8e1
--- /dev/null
@@ -0,0 +1,21 @@
+# coding: utf-8
+import autopath
+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)
+    multi = Multi([1,2,3], weakref.ref(c), i, 'int')
+    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()")