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


Python IndexesHolder.getObjectsStartingIn方法代码示例

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


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

示例1: TestCategoryDayIndex

# 需要导入模块: from MaKaC.common.indexes import IndexesHolder [as 别名]
# 或者: from MaKaC.common.indexes.IndexesHolder import getObjectsStartingIn [as 别名]
class TestCategoryDayIndex(unittest.TestCase):

    def setUp(self):
        DBMgr.getInstance().startRequest()
        self.oldIndex = IndexesHolder()._getIdx()["categoryDateLtd"]
        self.newIndex = IndexesHolder()._getIdx()["categoryDate"]
        self.startDate = datetime(2010,5,13, 10, 0, 0, tzinfo=timezone('UTC'))
        self.endDate = datetime(2010,5,14, 14, 0, 0, tzinfo=timezone('UTC'))
        self.ch = ConferenceHolder()
        self.categId = '0'

    def tearDownModule(self):
        DBMgr.getInstance().abort()
        DBMgr.getInstance().endRequest()

    def testGetObjectsStartingInDay(self):
        newRes = self.newIndex._idxCategItem[self.categId].getObjectsStartingInDay(self.startDate)
        oldTmp = self.oldIndex._idxCategItem[self.categId].getObjectsStartingInDay(self.startDate)
        oldRes = set()
        for res in oldTmp:
            oldRes.add(self.ch.getById(res))

        assert(oldRes == newRes)

    def testGetObjectsStartingIn(self):
        newRes = self.newIndex.getObjectsStartingIn(self.categId, self.startDate, self.endDate)
        oldTmp = self.oldIndex.getObjectsStartingIn(self.categId, self.startDate, self.endDate)
        oldRes = set()
        for res in oldTmp:
            oldRes.add(self.ch.getById(res))
        assert(oldRes == newRes)

    def testGetObjectsStartingAfterTest(self):
        newRes = self.newIndex._idxCategItem[self.categId].getObjectsStartingAfter(self.startDate)
        oldTmp = self.oldIndex._idxCategItem[self.categId].getObjectsStartingAfter(self.startDate)
        oldRes = set()
        for res in oldTmp:
            oldRes.add(self.ch.getById(res))
        assert(oldRes == newRes)

    def testGetObjectsEndingAfterTest(self):
        newRes = self.newIndex._idxCategItem[self.categId].getObjectsEndingAfter(self.startDate)
        oldTmp = self.oldIndex._idxCategItem[self.categId].getObjectsEndingAfter(self.startDate)
        oldRes = set()
        for res in oldTmp:
            oldRes.add(self.ch.getById(res))
        assert(oldRes == newRes)

    def testGetObjectsEndingInDay(self):
        newRes = self.newIndex._idxCategItem[self.categId].getObjectsEndingInDay(self.startDate)
        oldTmp = self.oldIndex._idxCategItem[self.categId].getObjectsEndingInDay(self.startDate)
        oldRes = set()
        for res in oldTmp:
            oldRes.add(self.ch.getById(res))
        assert(oldRes == newRes)

    def testGetObjectsEndingIn(self):
        newRes = self.newIndex._idxCategItem[self.categId].getObjectsEndingIn(self.startDate,self.endDate)
        oldTmp = self.oldIndex._idxCategItem[self.categId].getObjectsEndingIn(self.startDate,self.endDate)
        oldRes = set()
        for res in oldTmp:
            oldRes.add(self.ch.getById(res))
        assert(oldRes == newRes)

    def testGetObjectsInDay(self):
        newRes = self.newIndex._idxCategItem[self.categId].getObjectsInDay(self.startDate)
        oldTmp = self.oldIndex._idxCategItem[self.categId].getObjectsInDay(self.startDate)
        oldRes = set()
        for res in oldTmp:
            oldRes.add(self.ch.getById(res))
        assert(oldRes == newRes)

    def testGetObjectsIn(self):
        newRes = self.newIndex._idxCategItem[self.categId].getObjectsIn(self.startDate,self.endDate)
        oldTmp = self.oldIndex._idxCategItem[self.categId].getObjectsIn(self.startDate,self.endDate)
        oldRes = set()
        for res in oldTmp:
            oldRes.add(self.ch.getById(res))
        assert(oldRes == newRes)
开发者ID:NIIF,项目名称:indico,代码行数:81,代码来源:calendarDateIndex.py


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