當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。