当前位置: 首页>>代码示例>>Python>>正文


Python RootTask.build_from_config方法代码示例

本文整理汇总了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
开发者ID:pombredanne,项目名称:ecpy,代码行数:30,代码来源:test_loop_task.py

示例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
开发者ID:MatthieuDartiailh,项目名称:ecpy,代码行数:34,代码来源:test_loop_task.py

示例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'
开发者ID:pombredanne,项目名称:ecpy,代码行数:13,代码来源:test_task_interfaces.py

示例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'
开发者ID:MatthieuDartiailh,项目名称:ecpy,代码行数:14,代码来源:test_task_interfaces.py

示例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'
开发者ID:MatthieuDartiailh,项目名称:ecpy,代码行数:16,代码来源:test_task_interfaces.py

示例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)
开发者ID:pombredanne,项目名称:ecpy,代码行数:16,代码来源:test_base_tasks.py


注:本文中的ecpy.tasks.base_tasks.RootTask.build_from_config方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。