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


Python Conference.getSchedule方法代码示例

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


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

示例1: TestSchedule

# 需要导入模块: from MaKaC.conference import Conference [as 别名]
# 或者: from MaKaC.conference.Conference import getSchedule [as 别名]
class TestSchedule(unittest.TestCase):
    """Tests the schedule management functions
    """

    def setUp( self ):
        from MaKaC.user import Avatar
        a = Avatar()
        a.setId("creator")
        from MaKaC.conference import Conference
        self._conf = Conference( a )
        self._conf.setTimezone('UTC')

    def testTypeSetUp(self):
        #test setting up the schedule type of a session works correctly
        self._conf.setDates(datetime(2004,1,1,9,0,tzinfo=timezone('UTC')),datetime(2004,1,5,10,0,tzinfo=timezone('UTC')))
        session=Session()
        session.setStartDate(datetime(2004,1,1,9,0,tzinfo=timezone('UTC')))
        session.setDuration(hours=10,minutes=0)
        self._conf.addSession(session)
        slot1=SessionSlot(session)
        session.addSlot(slot1)
        c1,c2,c3=Contribution(),Contribution(),Contribution()
        session.addContribution(c1)
        session.addContribution(c2)
        session.addContribution(c3)
        slot1.getSchedule().addEntry(c1.getSchEntry())
        slot1.getSchedule().addEntry(c2.getSchEntry())
        slot1.getSchedule().addEntry(c3.getSchEntry())
        self.assert_(c1.getSchEntry()==slot1.getSchedule().getEntries()[0])
        self.assert_(c2.getSchEntry()==slot1.getSchedule().getEntries()[1])
        self.assert_(c3.getSchEntry()==slot1.getSchedule().getEntries()[2])
        self.assert_(session.getScheduleType()=="standard")
        self.assert_(slot1.getSchedule().__class__==conference.SlotSchedule)
        session.setScheduleType("poster")
        self.assert_(session.getScheduleType()=="poster")
        self.assert_(slot1.getSchedule().__class__==conference.PosterSlotSchedule)
        self.assert_(len(slot1.getSchedule().getEntries())==0)

    def testSessionDates(self):
        from MaKaC.conference import Session,SessionSlot, Conference
        self._conf.setStartDate(datetime(2004,1,1,10,0,tzinfo=timezone('UTC')))
        self._conf.setEndDate(datetime(2004,1,1,15,0,tzinfo=timezone('UTC')))
        session1=Session()
        session1.setStartDate(datetime(2004,1,1,10,0,tzinfo=timezone('UTC')))
        session1.setEndDate(datetime(2004,1,1,15,0,tzinfo=timezone('UTC')))
        self._conf.addSession(session1)
        slot1=SessionSlot(session1)
        slot1.setDuration(hours=2,minutes=0)
        slot1.setStartDate(datetime(2004,1,1,10,0,tzinfo=timezone('UTC')))
        session1.addSlot(slot1)
        # ------- SESSIONS -------
        # Session start date can not be bigger than the first slot start date
        self.assertRaises(MaKaCError, session1.setStartDate, datetime(2004,1,1,12,0,tzinfo=timezone('UTC')))
        # Session end date can not be prior than the last slot end date
        self.assertRaises(MaKaCError, session1.setEndDate, datetime(2004,1,1,11,0,tzinfo=timezone('UTC')))
        # Session duration must be bigger than zero.
        self.assertRaises(MaKaCError, session1.setDuration, 0,0)
        # Session start date can not be prior than the conference end date
        #self.assertRaises(MaKaCError, session1.setStartDate, datetime(2004,1,1,9,0,tzinfo=timezone('UTC')))
        # Session end date can not be bigger than the conference end date
        #self.assertRaises(MaKaCError, session1.setEndDate, datetime(2004,1,1,15,1,tzinfo=timezone('UTC')))
        # Session end date can not be bigger than the conference end date
        #self.assertRaises(MaKaCError, session1.setDuration, 6,1)

        # ------- SESSION SLOTS -------
        self._conf.setStartDate(datetime(2004,1,1,10,0,tzinfo=timezone('UTC')))
        self._conf.setEndDate(datetime(2004,1,1,15,0,tzinfo=timezone('UTC')))
        session1.setStartDate(datetime(2004,1,1,10,0,tzinfo=timezone('UTC')))
        session1.setEndDate(datetime(2004,1,1,15,0,tzinfo=timezone('UTC')))
        # Session slot duration must be bigger than zero.
        self.assertRaises(MaKaCError, slot1.setDuration, 0,0,0)
        # Forbid to create a slot alogn several days
        self._conf.setEndDate(datetime(2005,1,1,15,0,tzinfo=timezone('UTC')))
        self.assertRaises(MaKaCError, slot1.setDuration, 1,0,1)
        # Slot start date has to be between the session ones
        #self.assertRaises(MaKaCError, slot1.setStartDate, datetime(2004,1,1,9,59,tzinfo=timezone('UTC')))
        # Slot end date has to be between the session ones
        #self.assertRaises(MaKaCError, slot1.setDuration, 0,5,1)
        # If the duration is modified and any of the slot entries is affected then an excetpion is raised
        c1,c2,c3=Contribution(),Contribution(),Contribution()
        session1.addContribution(c1)
        session1.addContribution(c2)
        session1.addContribution(c3)
        c1.setDuration(0,30)
        c2.setDuration(0,30)
        c3.setDuration(0,30)
        from MaKaC.schedule import BreakTimeSchEntry
        b1=BreakTimeSchEntry()
        slot1.getSchedule().addEntry(c1.getSchEntry())
        slot1.getSchedule().addEntry(c2.getSchEntry())
        slot1.getSchedule().addEntry(c3.getSchEntry())
        self.assertRaises(MaKaCError, slot1.setDuration, 0,1,29)
        # Check that the duration of the entries do not overpass the slot duration
        slot1.setDuration(hours=1,minutes=30)
        #self.assertRaises(MaKaCError,c3.setDuration,0,31)
        c3.setDuration(0,30)
        slot1.setDuration(hours=2,minutes=0)
        slot1.getSchedule().addEntry(b1)
        #self.assertRaises(MaKaCError,b1.setDuration,0,31)
        #Check that entries start date is not less than owner start date
#.........这里部分代码省略.........
开发者ID:lukasnellen,项目名称:indico,代码行数:103,代码来源:testSessions.py


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