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


Python Component.register_component方法代码示例

本文整理汇总了Python中component.Component.register_component方法的典型用法代码示例。如果您正苦于以下问题:Python Component.register_component方法的具体用法?Python Component.register_component怎么用?Python Component.register_component使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在component.Component的用法示例。


在下文中一共展示了Component.register_component方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_should_return_list_of_lists

# 需要导入模块: from component import Component [as 别名]
# 或者: from component.Component import register_component [as 别名]
 def test_should_return_list_of_lists(self):
     """
     Should return list of lists if components registered
     """
     subject = Component()
     subject.register_component(Component())
     self.assertEqual(req.components_of_list(subject.components), [[]])
开发者ID:chazu,项目名称:dew_drop,代码行数:9,代码来源:requirement_test.py

示例2: test_should_return_components_of_component

# 需要导入模块: from component import Component [as 别名]
# 或者: from component.Component import register_component [as 别名]
    def test_should_return_components_of_component(self):
        """
        Should return components of component passed in
        """
        subject = Component()
        subject.register_component('doo')
        subject.register_component('pee')

        self.assertEqual(req.components_of(subject)[0],'doo')
开发者ID:chazu,项目名称:dew_drop,代码行数:11,代码来源:requirement_test.py

示例3: test_get_remote_hosts_sets_hosts

# 需要导入模块: from component import Component [as 别名]
# 或者: from component.Component import register_component [as 别名]
 def test_get_remote_hosts_sets_hosts(self):
     subject = Component()
     nic = Component()
     the_object = Component()
     the_object.state.set_flag("IS_NETWORK_HOST")
     subject.register_component(nic)
     nic.establish_duplex(the_object)
     subject.execute_behavior(network.GetNetworkHosts)
     self.assertEqual(len(subject.state.available_hosts), 1)
     self.assertIn(subject.state.available_hosts, the_object)
开发者ID:chazu,项目名称:dew_drop,代码行数:12,代码来源:integration_test.py

示例4: test_test_component_inputs_pass

# 需要导入模块: from component import Component [as 别名]
# 或者: from component.Component import register_component [as 别名]
 def test_test_component_inputs_pass(self):
     """test_component_inputs should return True if
     all input requirements are met"""
     requirement = lambda component : 'IS_FOO' in component.state.flags
     subject = Component()
     the_input = Component()
     the_input.state.set_flag('IS_FOO')
     subject.register_component(the_input)
     the_input.plug_into(subject)
     self.assertEqual(len(subject.item_inputs()), 1)
     self.assertEqual(req.test_component_inputs(subject, requirement), True)
开发者ID:chazu,项目名称:dew_drop,代码行数:13,代码来源:requirement_test.py

示例5: test_test_component_inputs_failure

# 需要导入模块: from component import Component [as 别名]
# 或者: from component.Component import register_component [as 别名]
    def test_test_component_inputs_failure(self):
        "test_component_inputs should return false if an unmet input requirement exists"
        the_input = Component()
        the_input.state.set_flag('BAR')
        requirement = lambda x: 'FOO' in x.state.flags
        subject = Component()
        self.assertIsInstance(the_input, Component)
        subject.plug_out_from(the_input)
        subject.register_component(the_input)

        self.assertFalse(req.test_component_inputs(the_input, requirement))
开发者ID:chazu,项目名称:dew_drop,代码行数:13,代码来源:requirement_test.py

示例6: test_should_return_list_of_lists_containing_components

# 需要导入模块: from component import Component [as 别名]
# 或者: from component.Component import register_component [as 别名]
 def test_should_return_list_of_lists_containing_components(self):
     """
     Should return list of lists with components in them
     if components registered
     """
     subject = Component()
     sub_subject = Component()
     returned_component = Component()
     sub_subject.register_component(returned_component)
     subject.register_component(sub_subject)
     self.assertEqual(req.components_of_list(subject.components), [[returned_component]])
开发者ID:chazu,项目名称:dew_drop,代码行数:13,代码来源:requirement_test.py

示例7: test_it_filters

# 需要导入模块: from component import Component [as 别名]
# 或者: from component.Component import register_component [as 别名]
 def test_it_filters(self):
     """
     It should filter out all components which
     do not have the specified flag
     """
     subject = Component()
     subject.register_component(Component())
     subject.register_component(Component())
     sub_subject = Component()
     sub_subject.state.set_flag('HEY')
     subject.register_component(sub_subject)
     self.assertEqual(len(req.components_filtered_for_flag(subject, 'HEY')), 1)
开发者ID:chazu,项目名称:dew_drop,代码行数:14,代码来源:requirement_test.py


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