add find test value in a multi's option
authorEmmanuel Garette <egarette@cadoles.com>
Sun, 22 Sep 2013 19:31:37 +0000 (21:31 +0200)
committerEmmanuel Garette <egarette@cadoles.com>
Sun, 22 Sep 2013 19:31:37 +0000 (21:31 +0200)
test/test_config_api.py

index ba268bc..ab4b484 100644 (file)
@@ -116,6 +116,23 @@ def test_find_in_config():
     #assert conf.find_first(byvalue=False, byname='dummy', byattrs=dict(default=False)) == conf.unwrap_from_path('gc.dummy')
 
 
+def test_find_multi():
+    b = BoolOption('bool', '', multi=True)
+    o = OptionDescription('od', '', [b])
+    conf = Config(o)
+    raises(AttributeError, "conf.find(byvalue=True)")
+    raises(AttributeError, "conf.find_first(byvalue=True)")
+    conf.bool.append(False)
+    raises(AttributeError, "conf.find(byvalue=True)")
+    raises(AttributeError, "conf.find_first(byvalue=True)")
+    conf.bool.append(False)
+    raises(AttributeError, "conf.find(byvalue=True)")
+    raises(AttributeError, "conf.find_first(byvalue=True)")
+    conf.bool.append(True)
+    assert conf.find(byvalue=True) == [b]
+    assert conf.find_first(byvalue=True) == b
+
+
 def test_does_not_find_in_config():
     descr = make_description()
     conf = Config(descr)