config.reset() remove informations too

This commit is contained in:
Emmanuel Garette 2018-09-09 23:04:36 +02:00
parent 3d07a9e88f
commit 5b518bffea
2 changed files with 6 additions and 3 deletions

View File

@ -350,15 +350,19 @@ def test_config_reset():
assert not c.option('gc.gc2.bool').value.get() assert not c.option('gc.gc2.bool').value.get()
assert not c.option('boolop').property.get() assert not c.option('boolop').property.get()
assert not c.option('boolop').permissive.get() assert not c.option('boolop').permissive.get()
assert not c.option('wantref').information.get('info', None)
# #
c.option('gc.gc2.bool').value.set(True) c.option('gc.gc2.bool').value.set(True)
c.option('boolop').property.add('test') c.option('boolop').property.add('test')
c.option('float').permissive.set(frozenset(['test'])) c.option('float').permissive.set(frozenset(['test']))
c.option('wantref').information.set('info', 'info')
assert c.option('gc.gc2.bool').value.get() assert c.option('gc.gc2.bool').value.get()
assert c.option('boolop').property.get() assert c.option('boolop').property.get()
assert c.option('float').permissive.get() assert c.option('float').permissive.get()
assert c.option('wantref').information.get('info', None)
# #
c.config.reset() c.config.reset()
assert not c.option('gc.gc2.bool').value.get() assert not c.option('gc.gc2.bool').value.get()
assert not c.option('boolop').property.get() assert not c.option('boolop').property.get()
assert not c.option('float').permissive.get() assert not c.option('float').permissive.get()
assert not c.option('wantref').information.get('info', None)

View File

@ -991,9 +991,6 @@ class TiramisuContextConfig(TiramisuContext):
def _c_meta(self): def _c_meta(self):
return Config(self.config_bag.context.cfgimpl_get_meta()) return Config(self.config_bag.context.cfgimpl_get_meta())
def _c_reset(self):
pass
def _m_new(self, name): def _m_new(self, name):
return Config(self.config_bag.context.new_config(name)) return Config(self.config_bag.context.new_config(name))
@ -1010,6 +1007,8 @@ class TiramisuContextConfig(TiramisuContext):
def _c_reset(self): def _c_reset(self):
# Option's values # Option's values
self.config_bag.context.cfgimpl_get_values()._p_.importation((tuple(), tuple(), tuple(), tuple())) self.config_bag.context.cfgimpl_get_values()._p_.importation((tuple(), tuple(), tuple(), tuple()))
# Option's informations
self.config_bag.context.cfgimpl_get_values()._p_.del_informations()
# Option's properties # Option's properties
self.config_bag.context.cfgimpl_get_settings()._p_.importation({}) self.config_bag.context.cfgimpl_get_settings()._p_.importation({})
# Option's permissives # Option's permissives