本文整理汇总了Python中muntjac.data.util.indexed_container.IndexedContainer.addContainerFilter方法的典型用法代码示例。如果您正苦于以下问题:Python IndexedContainer.addContainerFilter方法的具体用法?Python IndexedContainer.addContainerFilter怎么用?Python IndexedContainer.addContainerFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类muntjac.data.util.indexed_container.IndexedContainer
的用法示例。
在下文中一共展示了IndexedContainer.addContainerFilter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testEmptyFilteredIndexedContainer
# 需要导入模块: from muntjac.data.util.indexed_container import IndexedContainer [as 别名]
# 或者: from muntjac.data.util.indexed_container.IndexedContainer import addContainerFilter [as 别名]
def testEmptyFilteredIndexedContainer(self):
ic = IndexedContainer()
self.addProperties(ic)
self.populate(ic)
ic.addContainerFilter(self._PROPERTY_STRING_ID, 'aasdfasdfasdf',
True, False)
ic.sort([self._PROPERTY_STRING_ID], [True])
示例2: testFilteredIndexedContainer
# 需要导入模块: from muntjac.data.util.indexed_container import IndexedContainer [as 别名]
# 或者: from muntjac.data.util.indexed_container.IndexedContainer import addContainerFilter [as 别名]
def testFilteredIndexedContainer(self):
ic = IndexedContainer()
self.addProperties(ic)
self.populate(ic)
ic.addContainerFilter(self._PROPERTY_STRING_ID, 'a', True, False)
ic.sort([self._PROPERTY_STRING_ID], [True])
self.verifyOrder(ic, [self._ITEM_ANOTHER_NULL, self._ITEM_DATA_MINUS1,
self._ITEM_DATA_MINUS1_NULL, self._ITEM_DATA_MINUS2,
self._ITEM_DATA_MINUS2_NULL])
示例3: testAddRemoveContainerFilter
# 需要导入模块: from muntjac.data.util.indexed_container import IndexedContainer [as 别名]
# 或者: from muntjac.data.util.indexed_container.IndexedContainer import addContainerFilter [as 别名]
def testAddRemoveContainerFilter(self):
container = IndexedContainer()
counter = ItemSetChangeCounter()
container.addListener(counter)
# simply adding or removing container filters should cause events
# (content changes)
self.initializeContainer(container)
counter.reset()
container.addContainerFilter(self.SIMPLE_NAME, 'a', True, False)
counter.assertOnce()
container.removeContainerFilters(self.SIMPLE_NAME)
counter.assertOnce()
container.addContainerFilter(self.SIMPLE_NAME, 'a', True, False)
counter.assertOnce()
container.removeAllContainerFilters()
counter.assertOnce()
示例4: testItemSetChangeListenersFiltering
# 需要导入模块: from muntjac.data.util.indexed_container import IndexedContainer [as 别名]
# 或者: from muntjac.data.util.indexed_container.IndexedContainer import addContainerFilter [as 别名]
def testItemSetChangeListenersFiltering(self):
container = IndexedContainer()
counter = ItemSetChangeCounter()
container.addListener(counter)
counter.reset()
container.addContainerFilter(self.FULLY_QUALIFIED_NAME, 'Test', True, False)
# no real change, so no notification required
counter.assertNone()
id1 = 'com.example.Test1'
id2 = 'com.example.Test2'
id3 = 'com.example.Other'
# perform operations while filtering container
self.initializeContainer(container)
counter.reset()
# passes filter
item = container.addItem(id1)
# no event if filtered out
counter.assertNone()
item.getItemProperty(self.FULLY_QUALIFIED_NAME).setValue(id1)
counter.assertOnce()
# passes filter but already in the container
item = container.addItem(id1)
counter.assertNone()
self.initializeContainer(container)
counter.reset()
# passes filter after change
item = container.addItemAt(0, id1)
counter.assertNone()
item.getItemProperty(self.FULLY_QUALIFIED_NAME).setValue(id1)
counter.assertOnce()
item = container.addItemAt(len(container), id2)
counter.assertNone()
item.getItemProperty(self.FULLY_QUALIFIED_NAME).setValue(id2)
counter.assertOnce()
# passes filter but already in the container
item = container.addItemAt(0, id1)
counter.assertNone()
item = container.addItemAt(len(container), id2)
counter.assertNone()
self.initializeContainer(container)
counter.reset()
# passes filter
item = container.addItemAfter(None, id1)
counter.assertNone()
item.getItemProperty(self.FULLY_QUALIFIED_NAME).setValue(id1)
counter.assertOnce()
item = container.addItemAfter(container.lastItemId(), id2)
counter.assertNone()
item.getItemProperty(self.FULLY_QUALIFIED_NAME).setValue(id2)
counter.assertOnce()
# passes filter but already in the container
item = container.addItemAfter(None, id1)
counter.assertNone()
item = container.addItemAfter(container.lastItemId(), id2)
counter.assertNone()
# does not pass filter
# TODO implement rest
self.initializeContainer(container)
counter.reset()
item = container.addItemAfter(None, id3)
counter.assertNone()
item.getItemProperty(self.FULLY_QUALIFIED_NAME).setValue(id3)
counter.assertNone()
self.initializeContainer(container)
counter.reset()
item = container.addItemAfter(container.firstItemId(), id3)
counter.assertNone()
item.getItemProperty(self.FULLY_QUALIFIED_NAME).setValue(id3)
counter.assertNone()
self.initializeContainer(container)
counter.reset()
item = container.addItemAfter(container.lastItemId(), id3)
counter.assertNone()
item.getItemProperty(self.FULLY_QUALIFIED_NAME).setValue(id3)
counter.assertNone()
self.initializeContainer(container)
counter.reset()
item = container.addItemAt(0, id3)
counter.assertNone()
item.getItemProperty(self.FULLY_QUALIFIED_NAME).setValue(id3)
counter.assertNone()
self.initializeContainer(container)
counter.reset()
item = container.addItemAt(1, id3)
counter.assertNone()
item.getItemProperty(self.FULLY_QUALIFIED_NAME).setValue(id3)
counter.assertNone()
#.........这里部分代码省略.........