From ff7714d8d319aa86f9b9ed82a8bf6af3499feafd Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 22 Sep 2013 21:31:37 +0200 Subject: [PATCH] add find test value in a multi's option --- test/test_config_api.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/test_config_api.py b/test/test_config_api.py index ba268bc..ab4b484 100644 --- a/test/test_config_api.py +++ b/test/test_config_api.py @@ -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)