當前位置: 首頁>>代碼示例>>Python>>正文


Python Conference.addSessionCoordinator方法代碼示例

本文整理匯總了Python中MaKaC.conference.Conference.addSessionCoordinator方法的典型用法代碼示例。如果您正苦於以下問題:Python Conference.addSessionCoordinator方法的具體用法?Python Conference.addSessionCoordinator怎麽用?Python Conference.addSessionCoordinator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MaKaC.conference.Conference的用法示例。


在下文中一共展示了Conference.addSessionCoordinator方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: TestBasicManagement

# 需要導入模塊: from MaKaC.conference import Conference [as 別名]
# 或者: from MaKaC.conference.Conference import addSessionCoordinator [as 別名]

#.........這裏部分代碼省略.........
        self.assert_(self._conf.getSessionById(session1.getId())==None)

    def testDateModification(self):
        self._conf.setDates(datetime(2004,1,1,tzinfo=timezone('UTC')),datetime(2004,1,5,tzinfo=timezone('UTC')))
        ##checks that a session cannot be added if its dates are outside the 
        ##   schedule boundaries
        #s1=Session()
        #s1.setDates(datetime(2003,12,31,tzinfo=timezone('UTC')),datetime(2004,1,31,tzinfo=timezone('UTC')))
        #self.assertRaises(MaKaCError,self._conf.addSession,s1)
        #s1.setDates(datetime(2004,1,1,11,0,tzinfo=timezone('UTC')),datetime(2004,1,31,tzinfo=timezone('UTC')))
        #self.assertRaises(MaKaCError,self._conf.addSession,s1)
        #s1.setDates(datetime(2004,1,1,11,0,tzinfo=timezone('UTC')),datetime(2004,1,4,tzinfo=timezone('UTC')))
        #self._conf.addSession(s1)
        #self._conf.removeSession(s1)
        #self._conf.getSchedule().setDates(datetime(2004,1,2,tzinfo=timezone('UTC')),datetime(2004,1,7,tzinfo=timezone('UTC')))
        #s1=Session()
        #s1.setDates(datetime(2003,12,31,tzinfo=timezone('UTC')),datetime(2004,1,31,tzinfo=timezone('UTC')))
        #self.assertRaises(MaKaCError,self._conf.addSession,s1)
        #s1.setDates(datetime(2004,1,1,11,0,tzinfo=timezone('UTC')),datetime(2004,1,31,tzinfo=timezone('UTC')))
        #self.assertRaises(MaKaCError,self._conf.addSession,s1)
        #s1.setDates(datetime(2004,1,1,11,0,tzinfo=timezone('UTC')),datetime(2004,1,4,tzinfo=timezone('UTC')))
        #self.assertRaises(MaKaCError,self._conf.addSession,s1)
        #s1.setDates(datetime(2004,1,2,11,0,tzinfo=timezone('UTC')),datetime(2004,1,6,tzinfo=timezone('UTC')))
        #self._conf.addSession(s1)
        ##checks that when modifying the session dates to ones which are outside
        ##   the conference schedule scope is not allowed
        #s1.setDates(datetime(2004,1,3,tzinfo=timezone('UTC')),datetime(2004,1,5,tzinfo=timezone('UTC')))
        #self.assertRaises(MaKaCError,s1.setDates,datetime(2004,1,3,tzinfo=timezone('UTC')),datetime(2004,1,8,tzinfo=timezone('UTC')))
        #self.assertRaises(MaKaCError,s1.setDates,datetime(2005,1,1,11,0,tzinfo=timezone('UTC')),datetime(2004,1,6,tzinfo=timezone('UTC')))
        #self.assertRaises(MaKaCError,s1.setDates,datetime(2005,1,1,11,0,tzinfo=timezone('UTC')),datetime(2004,1,8,tzinfo=timezone('UTC')))

    def testContributionInclusion(self):
        session1,session2=Session(),Session()
        self._conf.addSession(session1)
        self._conf.addSession(session2)
        contrib1=Contribution()
        session1.addContribution(contrib1)
        self.assert_(self._conf.hasContribution(contrib1))
        self.assert_(session1.hasContribution(contrib1))
        self.assert_(not session2.hasContribution(contrib1))
        session1.removeContribution(contrib1)
        session2.addContribution(contrib1)
        self.assert_(self._conf.hasContribution(contrib1))
        self.assert_(not session1.hasContribution(contrib1))
        self.assert_(session2.hasContribution(contrib1))
        session2.removeContribution(contrib1)
        self.assert_(self._conf.hasContribution(contrib1))
        self.assert_(not session1.hasContribution(contrib1))
        self.assert_(not session2.hasContribution(contrib1))

    def testCoordination(self):
        session1,session2,session3=Session(),Session(),Session()
        self._conf.addSession(session1)
        self._conf.addSession(session2)
        c1,c2=Avatar(),Avatar()
        c1.setId("1")
        c2.setId("2")
        session1.addCoordinator(c1)
        self.assert_(c1 in session1.getCoordinatorList())
        self.assert_(len(session1.getCoordinatorList())==1)
        self.assert_(session1.isCoordinator(c1))
        self.assert_(not session1.isCoordinator(c2))
        self.assert_(not session1.isCoordinator(None))
        self.assert_(session1 in self._conf.getCoordinatedSessions(c1))
        self.assert_(len(self._conf.getCoordinatedSessions(c1))==1)
        self.assert_(len(self._conf.getCoordinatedSessions(c2))==0)
        self._conf.addSessionCoordinator(session1,c1)
        self.assert_(c1 in session1.getCoordinatorList())
        self.assert_(len(session1.getCoordinatorList())==1)
        self.assert_(session1.isCoordinator(c1))
        self.assert_(not session1.isCoordinator(c2))
        self.assert_(not session1.isCoordinator(None))
        self.assert_(session1 in self._conf.getCoordinatedSessions(c1))
        self.assert_(len(self._conf.getCoordinatedSessions(c1))==1)
        self.assert_(len(self._conf.getCoordinatedSessions(c2))==0)
        self._conf.addSessionCoordinator(session2,c2)
        self.assert_(c2 in session2.getCoordinatorList())
        self.assert_(not session1.isCoordinator(c2))
        self.assert_(session2 in self._conf.getCoordinatedSessions(c2))
        self.assert_(len(self._conf.getCoordinatedSessions(c1))==1)
        self.assert_(len(self._conf.getCoordinatedSessions(c2))==1)
        self._conf.addSession(session3)
        session3.addCoordinator(c2)
        self.assert_(c2 in session3.getCoordinatorList())
        self.assert_(not session1.isCoordinator(c2))
        self.assert_(session3 in self._conf.getCoordinatedSessions(c2))
        self.assert_(session2 in self._conf.getCoordinatedSessions(c2))
        self.assert_(len(self._conf.getCoordinatedSessions(c1))==1)
        self.assert_(len(self._conf.getCoordinatedSessions(c2))==2)
        self._conf.removeSession(session1)
        self.assert_(session1 not in self._conf.getCoordinatedSessions(c1))
        self.assert_(len(self._conf.getCoordinatedSessions(c1))==0)
        self.assert_(len(self._conf.getCoordinatedSessions(c2))==2)
        session2.removeCoordinator(c2)
        self.assert_(c2 not in session2.getCoordinatorList())
        self.assert_(c2 in session3.getCoordinatorList())
        self.assert_(session3 in self._conf.getCoordinatedSessions(c2))
        self.assert_(session2 not in self._conf.getCoordinatedSessions(c2))
        self.assert_(len(self._conf.getCoordinatedSessions(c1))==0)
        self.assert_(len(self._conf.getCoordinatedSessions(c2))==1)
開發者ID:lukasnellen,項目名稱:indico,代碼行數:104,代碼來源:testSessions.py


注:本文中的MaKaC.conference.Conference.addSessionCoordinator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。