feat: option.type can return the symlink type
This commit is contained in:
parent
0c993eddb0
commit
42471d42b7
2 changed files with 5 additions and 1 deletions
|
@ -28,6 +28,8 @@ def test_symlink_option(config_type):
|
||||||
assert cfg.option('c').issymlinkoption()
|
assert cfg.option('c').issymlinkoption()
|
||||||
assert cfg.option('s1.b').type() == 'boolean'
|
assert cfg.option('s1.b').type() == 'boolean'
|
||||||
assert cfg.option('c').type() == 'boolean'
|
assert cfg.option('c').type() == 'boolean'
|
||||||
|
assert cfg.option('s1.b').type(only_self=True) == 'boolean'
|
||||||
|
assert cfg.option('c').type(only_self=True) == 'symlink'
|
||||||
assert cfg.option('s1.b').value.get() is False
|
assert cfg.option('s1.b').value.get() is False
|
||||||
cfg.option("s1.b").value.set(True)
|
cfg.option("s1.b").value.set(True)
|
||||||
cfg.option("s1.b").value.set(False)
|
cfg.option("s1.b").value.set(False)
|
||||||
|
|
|
@ -348,11 +348,13 @@ class _TiramisuOptionOptionDescription:
|
||||||
return options
|
return options
|
||||||
|
|
||||||
@option_type(["option", "optiondescription", "symlink", "with_or_without_index"])
|
@option_type(["option", "optiondescription", "symlink", "with_or_without_index"])
|
||||||
def type(self):
|
def type(self, only_self=False):
|
||||||
"""Get de option type"""
|
"""Get de option type"""
|
||||||
option = self._subconfig.option
|
option = self._subconfig.option
|
||||||
if option.impl_is_optiondescription():
|
if option.impl_is_optiondescription():
|
||||||
return "optiondescription"
|
return "optiondescription"
|
||||||
|
if only_self and option.impl_is_symlinkoption():
|
||||||
|
return 'symlink'
|
||||||
return option.get_type()
|
return option.get_type()
|
||||||
|
|
||||||
@option_type(["option", "symlink", "with_or_without_index"])
|
@option_type(["option", "symlink", "with_or_without_index"])
|
||||||
|
|
Loading…
Reference in a new issue