本文整理汇总了Python中compositecore.Composite.add_spoof_child方法的典型用法代码示例。如果您正苦于以下问题:Python Composite.add_spoof_child方法的具体用法?Python Composite.add_spoof_child怎么用?Python Composite.add_spoof_child使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类compositecore.Composite
的用法示例。
在下文中一共展示了Composite.add_spoof_child方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_children_with_tag_may_return_spoofed_children_with_tag
# 需要导入模块: from compositecore import Composite [as 别名]
# 或者: from compositecore.Composite import add_spoof_child [as 别名]
def test_get_children_with_tag_may_return_spoofed_children_with_tag(self):
c = Composite()
component_1 = TestComponent(id_1, [tag_1])
component_2 = TestComponent(id_2, [tag_1])
c.set_child(component_1)
c.add_spoof_child(component_2)
self.assertIn(component_1, c.get_children_with_tag(tag_1))
self.assertIn(component_2, c.get_children_with_tag(tag_1))
示例2: test_get_children_with_tag_should_not_return_removed_spoofed_children
# 需要导入模块: from compositecore import Composite [as 别名]
# 或者: from compositecore.Composite import add_spoof_child [as 别名]
def test_get_children_with_tag_should_not_return_removed_spoofed_children(self):
c = Composite()
component_1 = TestComponent(id_1, [tag_1])
component_2 = TestComponent(id_2, [tag_1])
c.set_child(component_1)
c.add_spoof_child(component_2)
c.reset_spoofed_children()
self.assertIn(component_1, c.get_children_with_tag(tag_1))
self.assertNotIn(component_2, c.get_children_with_tag(tag_1))