本文整理匯總了Python中compositecore.Composite.remove_component方法的典型用法代碼示例。如果您正苦於以下問題:Python Composite.remove_component方法的具體用法?Python Composite.remove_component怎麽用?Python Composite.remove_component使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類compositecore.Composite
的用法示例。
在下文中一共展示了Composite.remove_component方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_get_children_with_does_not_return_removed_children
# 需要導入模塊: from compositecore import Composite [as 別名]
# 或者: from compositecore.Composite import remove_component [as 別名]
def test_get_children_with_does_not_return_removed_children(self):
c = Composite()
component_1 = TestComponent(id_1, [tag_1])
component_2 = TestComponent(id_2, [tag_1])
c.set_child(component_1)
c.set_child(component_2)
c.remove_component(component_1)
self.assertNotIn(component_1, c.get_children_with_tag(tag_1))
self.assertIn(component_2, c.get_children_with_tag(tag_1))
示例2: test_when_a_component_is_removed_it_should_not_be_gettable_by_tag
# 需要導入模塊: from compositecore import Composite [as 別名]
# 或者: from compositecore.Composite import remove_component [as 別名]
def test_when_a_component_is_removed_it_should_not_be_gettable_by_tag(self):
c = Composite()
component1 = DummyComponent("x", "a")
c.set_child(component1)
self.assertEqual(len(c.get_children_with_tag("a")), 1)
self.assertTrue(component1 in c.get_children_with_tag("a"))
c.remove_component(component1)
self.assertEqual(len(c.get_children_with_tag("a")), 0)
self.assertFalse(component1 in c.get_children_with_tag("a"))