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


Python Conference.getCoordinatedSessions方法代码示例

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


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

示例1: TestBasicManagement

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

    def setUp( self ):
        a = Avatar()
        a.setId("creator")
        self._conf = Conference( a )
        self._conf.setDates(datetime(2000,1,1,tzinfo=timezone('UTC')),datetime(2020,1,1,tzinfo=timezone('UTC')))

    def testDates(self):
        session1=Session()
        #self._conf.setStartDate(datetime(2004,1,1,8,0,tzinfo=timezone('UTC')))
        #self._conf.setEndDate(datetime(2005,1,1,8,0,tzinfo=timezone('UTC')))
        session1.setStartDate(datetime(2004,2,15,tzinfo=timezone('UTC')))
        self.assertRaises(MaKaCError,session1.setEndDate,datetime(2004,2,14,tzinfo=timezone('UTC')))
        session1.setEndDate(datetime(2004,2,16,tzinfo=timezone('UTC')))
        self.assert_(session1.getStartDate()==datetime(2004,2,15,tzinfo=timezone('UTC')))
        self.assert_(session1.getEndDate()==datetime(2004,2,16,tzinfo=timezone('UTC')))
        session1.setDates(datetime(2004,2,10,tzinfo=timezone('UTC')),datetime(2004,2,11,tzinfo=timezone('UTC')))
        self.assert_(session1.getStartDate()==datetime(2004,2,10,tzinfo=timezone('UTC')))
        self.assert_(session1.getEndDate()==datetime(2004,2,11,tzinfo=timezone('UTC')))
        session1.setDates(datetime(2004,2,15,tzinfo=timezone('UTC')),datetime(2004,2,16,tzinfo=timezone('UTC')))
        self.assert_(session1.getStartDate()==datetime(2004,2,15,tzinfo=timezone('UTC')))
        self.assert_(session1.getEndDate()==datetime(2004,2,16,tzinfo=timezone('UTC')))
        session1.setDates(datetime(2004,2,14,tzinfo=timezone('UTC')),datetime(2004,2,17,tzinfo=timezone('UTC')))
        self.assert_(session1.getStartDate()==datetime(2004,2,14,tzinfo=timezone('UTC')))
        self.assert_(session1.getEndDate()==datetime(2004,2,17,tzinfo=timezone('UTC')))

    def testBasicAddAndRemove( self ):
        session1,session2=Session(),Session()
        self._conf.addSession(session1)
        self.assert_(self._conf.getSessionById(session1.getId())==session1)
        self.assert_(session1 in self._conf.getSessionList())
        session1.delete()
        self.assert_(session1 not in self._conf.getSessionList())
        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))
#.........这里部分代码省略.........
开发者ID:lukasnellen,项目名称:indico,代码行数:103,代码来源:testSessions.py


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