本文整理汇总了Python中ecpy.tasks.base_tasks.RootTask.build_from_config方法的典型用法代码示例。如果您正苦于以下问题:Python RootTask.build_from_config方法的具体用法?Python RootTask.build_from_config怎么用?Python RootTask.build_from_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ecpy.tasks.base_tasks.RootTask
的用法示例。
在下文中一共展示了RootTask.build_from_config方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_saving_building_from_config
# 需要导入模块: from ecpy.tasks.base_tasks import RootTask [as 别名]
# 或者: from ecpy.tasks.base_tasks.RootTask import build_from_config [as 别名]
def test_saving_building_from_config(self):
"""Done here as the LoopTask is a viable case of a member tagged with
child.
"""
subtask1 = CheckTask(name='check', database_entries={'val': 1})
self.task.task = subtask1
self.root.update_preferences_from_members()
new = RootTask.build_from_config(self.root.preferences,
{'ecpy.task': {'RootTask': RootTask,
'LoopTask': LoopTask,
'CheckTask': CheckTask}
})
assert new.children[0].task.name == 'check'
self.root.update_preferences_from_members()
prefs = self.root.preferences
del prefs['children_0']['task']
new = RootTask.build_from_config(prefs,
{'ecpy.task': {'RootTask': RootTask,
'LoopTask': LoopTask,
'CheckTask': CheckTask}
})
assert not new.children[0].task
示例2: test_saving_building_from_config
# 需要导入模块: from ecpy.tasks.base_tasks import RootTask [as 别名]
# 或者: from ecpy.tasks.base_tasks.RootTask import build_from_config [as 别名]
def test_saving_building_from_config(self, iterable_interface):
"""Done here as the LoopTask is a viable case of a member tagged with
child.
"""
subtask1 = CheckTask(name='check', database_entries={'val': 1})
self.task.task = subtask1
self.root.update_preferences_from_members()
deps = {'ecpy.task': {'ecpy.RootTask': RootTask,
'ecpy.LoopTask': LoopTask,
'ecpy.CheckTask': CheckTask}
}
new = RootTask.build_from_config(self.root.preferences, deps)
assert new.children[0].task.name == 'check'
self.task.interface = iterable_interface
self.root.update_preferences_from_members()
prefs = self.root.preferences
del prefs['children_0']['task']
deps = {'ecpy.task': {'ecpy.RootTask': RootTask,
'ecpy.LoopTask': LoopTask,
'ecpy.CheckTask': CheckTask},
'ecpy.tasks.interface':
{('IterableLoopInterface', ('ecpy.LoopTask',)):
IterableLoopInterface}
}
new = RootTask.build_from_config(prefs, deps)
assert not new.children[0].task
示例3: test_build_from_config1
# 需要导入模块: from ecpy.tasks.base_tasks import RootTask [as 别名]
# 或者: from ecpy.tasks.base_tasks.RootTask import build_from_config [as 别名]
def test_build_from_config1(self):
"""Test building a interfaceable task with no interface from a config.
"""
aux = RootTask()
aux.add_child_task(0, IMixin())
print(aux.preferences)
bis = RootTask.build_from_config(aux.preferences,
{'ecpy.task': {'IMixin': IMixin,
'RootTask': RootTask}})
assert type(bis.children[0]).__name__ == 'IMixin'
示例4: test_build_from_config2
# 需要导入模块: from ecpy.tasks.base_tasks import RootTask [as 别名]
# 或者: from ecpy.tasks.base_tasks.RootTask import build_from_config [as 别名]
def test_build_from_config2(self):
"""Test building a interfaceable task with an interface from a config.
"""
self.mixin.interface = InterfaceTest(answer=True)
self.root.update_preferences_from_members()
deps = {'ecpy.task': {'tests.Mixin': Mixin, 'ecpy.RootTask': RootTask},
'ecpy.tasks.interface':
{('InterfaceTest', ('tests.Mixin',)): InterfaceTest}}
bis = RootTask.build_from_config(self.root.preferences, deps)
assert type(bis.children[0].interface).__name__ == 'InterfaceTest'
示例5: test_build_from_config1
# 需要导入模块: from ecpy.tasks.base_tasks import RootTask [as 别名]
# 或者: from ecpy.tasks.base_tasks.RootTask import build_from_config [as 别名]
def test_build_from_config1(self):
"""Test building a interfaceable interface with no interface from a
config.
"""
aux = RootTask()
mixin = Mixin()
mixin.interface = InterfaceTest3()
aux.add_child_task(0, mixin)
deps = {'ecpy.task': {'tests.Mixin': Mixin, 'ecpy.RootTask': RootTask},
'ecpy.tasks.interface':
{('InterfaceTest3', ('tests.Mixin',)): InterfaceTest3}}
bis = RootTask.build_from_config(aux.preferences, deps)
assert type(bis.children[0].interface).__name__ == 'InterfaceTest3'
示例6: test_build_root_from_config
# 需要导入模块: from ecpy.tasks.base_tasks import RootTask [as 别名]
# 或者: from ecpy.tasks.base_tasks.RootTask import build_from_config [as 别名]
def test_build_root_from_config():
"""Test building a RootTask from config.
"""
config = {'name': 'test',
'children_0': {'name': 'test_child',
'task_class': 'SimpleTask'}}
task = RootTask.build_from_config(config,
{'ecpy.task':
{'SimpleTask': SimpleTask}})
assert task.name == 'Root'
assert len(task.children) == 1
assert task.children[0].name == 'test_child'
assert isinstance(task.children[0], SimpleTask)