add fullpath to make_dict

This commit is contained in:
2017-01-06 21:01:24 +01:00
parent df90e74819
commit 66f24bd1c0
3 changed files with 36 additions and 7 deletions

View File

@ -134,6 +134,24 @@ def test_make_dict_with_disabled_in_callback():
assert d == {"s1.a": False, "int": 42}
def test_make_dict_fullpath():
descr = OptionDescription("root", "", [
OptionDescription("opt", "", [
OptionDescription("s1", "", [
BoolOption("a", "", default=False),
BoolOption("b", "", default=False, properties=('disabled',))]),
OptionDescription("s2", "", [
BoolOption("a", "", default=False),
BoolOption("b", "", default=False)], properties=('disabled',)),
IntOption("int", "", default=42)]),
IntOption("introot", "", default=42)])
config = Config(descr)
config.read_only()
assert config.make_dict() == {"opt.s1.a": False, "opt.int": 42, "introot": 42}
assert config.opt.make_dict() == {"s1.a": False, "int": 42}
assert config.opt.make_dict(fullpath=True) == {"opt.s1.a": False, "opt.int": 42}
def test_find_in_config():
"finds option in config"
descr = make_description()