return tiramisuAPI

This commit is contained in:
Emmanuel Garette 2018-08-14 22:25:31 +02:00
parent 3210a54ab8
commit a37a37cc44
2 changed files with 7 additions and 6 deletions

View File

@ -187,17 +187,17 @@ def test_meta_meta():
def test_meta_new_config(): def test_meta_new_config():
od = make_description() od = make_description()
meta = MetaConfig(['name1', 'name2'], optiondescription=od) meta = MetaConfig(['name1', 'name2'], optiondescription=od)
assert len(meta.config.list()) == 2 assert len(list(meta.config.list())) == 2
meta.config.new('newconf1') meta.config.new('newconf1')
assert len(meta.config.list()) == 3 assert len(list(meta.config.list())) == 3
def test_meta_new_config_wrong_name(): def test_meta_new_config_wrong_name():
od = make_description() od = make_description()
meta = MetaConfig(['name1', 'name2'], optiondescription=od) meta = MetaConfig(['name1', 'name2'], optiondescription=od)
assert len(meta.config.list()) == 2 assert len(list(meta.config.list())) == 2
raises(ConflictError, "meta.config.new('name1')") raises(ConflictError, "meta.config.new('name1')")
assert len(meta.config.list()) == 2 assert len(list(meta.config.list())) == 2
def test_meta_meta_set(): def test_meta_meta_set():

View File

@ -923,13 +923,14 @@ class TiramisuContextConfig(TiramisuContext):
return TiramisuAPI(self.config_bag.context.duplicate(session_id)) return TiramisuAPI(self.config_bag.context.duplicate(session_id))
def _m_new(self, name): def _m_new(self, name):
self.config_bag.context.new_config(name) return TiramisuAPI(self.config_bag.context.new_config(name))
def _m_list(self): def _m_list(self):
return self._g_list() return self._g_list()
def _g_list(self): def _g_list(self):
return self.config_bag.context.cfgimpl_get_children() for child in self.config_bag.context.cfgimpl_get_children():
yield TiramisuAPI(child)
def __getattr__(self, def __getattr__(self,
name: str) -> Callable: name: str) -> Callable: