本文整理汇总了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), [[]])
示例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')
示例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)
示例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)
示例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))
示例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]])
示例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)