'getattr' in optiondescription can return a bound method
This commit is contained in:
parent
7c8164090a
commit
6d8137160c
|
@ -331,3 +331,16 @@ def test_config_str():
|
|||
cfg.read_only()
|
||||
str(cfg)
|
||||
str(cfg.o)
|
||||
|
||||
|
||||
def test_config_od_function():
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
gcdummy1 = BoolOption('dummy1', 'dummy', default=False, properties=('disabled',))
|
||||
o = OptionDescription('o', '', [gcdummy, gcdummy1])
|
||||
descr = OptionDescription('tiramisu', '', [o])
|
||||
cfg = Config(descr)
|
||||
try:
|
||||
print cfg.impl_get_opt_by_path()
|
||||
except AttributeError, err:
|
||||
assert str(err) == _('unknown Option {0} in OptionDescription {1}'
|
||||
'').format('impl_get_opt_by_path', descr._name)
|
||||
|
|
|
@ -98,7 +98,6 @@ def test_deref_option_config():
|
|||
assert w() is None
|
||||
|
||||
|
||||
#FIXME rien a voir mais si je fais un config.impl_get_path_by_opt() ca me retourne la methode !
|
||||
def test_deref_optiondescription_config():
|
||||
b = BoolOption('b', '')
|
||||
o = OptionDescription('od', '', [b])
|
||||
|
@ -109,8 +108,7 @@ def test_deref_optiondescription_config():
|
|||
del(o)
|
||||
assert w() is not None
|
||||
del(c)
|
||||
#FIXME
|
||||
#assert w() is None
|
||||
assert w() is None
|
||||
|
||||
|
||||
def test_deref_groupconfig():
|
||||
|
|
|
@ -234,7 +234,7 @@ class SubConfig(object):
|
|||
name, force_permissive=force_permissive)
|
||||
return homeconfig.getattr(name, force_permissive=force_permissive,
|
||||
validate=validate)
|
||||
opt_or_descr = getattr(self.cfgimpl_get_description(), name)
|
||||
opt_or_descr = self.cfgimpl_get_description().__getattr__(name)
|
||||
if self._impl_path is None:
|
||||
subpath = name
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue