support _path for symlinkoption and root OD
This commit is contained in:
@ -273,6 +273,7 @@ def test_symlink_dependency():
|
||||
assert api.option('s1.b').option.has_dependency(False) is True
|
||||
assert api.option('c').option.has_dependency(False) is False
|
||||
|
||||
|
||||
def test_symlink_makedict():
|
||||
boolopt = BoolOption("b", "", default=False)
|
||||
linkopt = SymLinkOption("c", boolopt)
|
||||
@ -282,3 +283,20 @@ def test_symlink_makedict():
|
||||
assert api.value.dict() == {'c': False, 's1.b': False}
|
||||
api.option('s1.b').value.set(True)
|
||||
assert api.value.dict() == {'c': True, 's1.b': True}
|
||||
|
||||
|
||||
def test_symlink_list():
|
||||
boolopt = BoolOption("b", "", default=False)
|
||||
linkopt = SymLinkOption("c", boolopt)
|
||||
descr = OptionDescription("opt", "",
|
||||
[linkopt, OptionDescription("s1", "", [boolopt])])
|
||||
api = Config(descr)
|
||||
list_opt = []
|
||||
for opt in api.option.list():
|
||||
list_opt.append(opt.option.path())
|
||||
assert list_opt == ['c']
|
||||
#
|
||||
list_opt = []
|
||||
for opt in api.option.list(recursive=True):
|
||||
list_opt.append(opt.option.path())
|
||||
assert list_opt == ['c', 's1.b']
|
||||
|
Reference in New Issue
Block a user