diff --git a/test/test_config.py b/test/test_config.py index 5e96366..df3b84d 100644 --- a/test/test_config.py +++ b/test/test_config.py @@ -173,3 +173,17 @@ def test_get_modified_values(): assert config.cfgimpl_get_values().get_modified_values() == {'od.g5': ('user', 'yes')} config.od.g4 = True assert config.cfgimpl_get_values().get_modified_values() == {'od.g5': ('user', 'yes'), 'od.g4': ('user', True)} + + +def test_has_value(): + g1 = IntOption('g1', '', 1) + g2 = StrOption('g2', '', 'héhé') + g3 = UnicodeOption('g3', '', u'héhé') + g4 = BoolOption('g4', '', True) + g5 = StrOption('g5', '') + d1 = OptionDescription('od', '', [g1, g2, g3, g4, g5]) + root = OptionDescription('root', '', [d1]) + config = Config(root) + assert not g5 in config.cfgimpl_get_values() + config.od.g5 = 'yes' + assert g5 in config.cfgimpl_get_values() diff --git a/tiramisu/value.py b/tiramisu/value.py index a5827bc..9535869 100644 --- a/tiramisu/value.py +++ b/tiramisu/value.py @@ -92,10 +92,10 @@ class Values(object): :param opt: the `option.Option()` object """ path = self._get_opt_path(opt) - self._contains(path) + return self._contains(path) def _contains(self, path): - return self._p_.hasvalue('value', path) + return self._p_.hasvalue(path) def __delitem__(self, opt): """overrides the builtins `del()` instructions"""