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


Python Conference.getContributionList方法代码示例

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


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

示例1: TestBasicManagement

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

    def setUp( self ):
        self._creator=Avatar()
        self._creator.setId("creator")
        self._conf=Conference(self._creator)
        self._conf.setTimezone('UTC')

        confTZ = self._conf.getTimezone()
        sd = timezone(confTZ).localize(datetime(2000, 1, 1))
        sdUTC = sd.astimezone(timezone('UTC'))
        ed = timezone(confTZ).localize(datetime(2020, 1, 1))
        edUTC = ed.astimezone(timezone('UTC'))
        self._conf.setDates(sdUTC,edUTC)

    def testAddRemoveSessions(self):
        s1,s2=Session(),Session()
        self._conf.addSession(s1)
        self._conf.addSession(s2)
        self.assert_(s1 in self._conf.getSessionList())
        self.assert_(s1==self._conf.getSessionById(s1.getId()))
        self.assert_(s2 in self._conf.getSessionList())
        self.assert_(s2==self._conf.getSessionById(s2.getId()))
        self._conf.removeSession(s1)
        self.assert_(s1 not in self._conf.getSessionList())
        self.assert_(None==self._conf.getSessionById(s1.getId()))
        self.assert_(s2 in self._conf.getSessionList())
        self.assert_(s2==self._conf.getSessionById(s2.getId()))
        c1,c2,c3=Contribution(),Contribution(),Contribution()
        self._conf.addSession(s1)
        s1.addContribution(c1)
        s1.addContribution(c2)
        s2.addContribution(c3)
        self.assert_(s1 in self._conf.getSessionList())
        self.assert_(s1==self._conf.getSessionById(s1.getId()))
        self.assert_(s2 in self._conf.getSessionList())
        self.assert_(s2==self._conf.getSessionById(s2.getId()))
        self.assert_(c1 in self._conf.getContributionList())
        self.assert_(c2 in self._conf.getContributionList())
        self.assert_(c3 in self._conf.getContributionList())
        self.assert_(c1 in s1.getContributionList())
        self.assert_(c2 in s1.getContributionList())
        self.assert_(c3 in s2.getContributionList())
        self._conf.removeSession(s1)
        self.assert_(s1 not in self._conf.getSessionList())
        self.assert_(s2 in self._conf.getSessionList())
        self.assert_(c1 in self._conf.getContributionList())
        self.assert_(c2 in self._conf.getContributionList())
        self.assert_(c3 in self._conf.getContributionList())
        self.assert_(c1 not in s1.getContributionList())
        self.assert_(c1.getSession()==None)
        self.assert_(c2.getSession()==None)
        self.assert_(c2 not in s1.getContributionList())
        self.assert_(c3 in s2.getContributionList())
开发者ID:lukasnellen,项目名称:indico,代码行数:58,代码来源:testConferences.py

示例2: TestContributionList

# 需要导入模块: from MaKaC.conference import Conference [as 别名]
# 或者: from MaKaC.conference.Conference import getContributionList [as 别名]
class TestContributionList(unittest.TestCase):
    """Tests the contribution list 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')
        self._conf.setDates(datetime(2000,1,1,tzinfo=timezone('UTC')),datetime(2020,1,1,tzinfo=timezone('UTC')))

    def testSorting( self ):
        from MaKaC.conference import Contribution, ContributionType, Session, Track
        from MaKaC.webinterface.common import contribFilters
        from MaKaC.common.filters import SimpleFilter
        contrib1 = Contribution()
        contrib2 = Contribution()
        contrib3 = Contribution()
        self._conf.addContribution( contrib1 )
        self._conf.addContribution( contrib2 )
        self._conf.addContribution( contrib3 )
        # Sorting by ID
        sortingCrit = contribFilters.SortingCriteria( ["number"] )
        f = SimpleFilter( None, sortingCrit )
        contribList = f.apply(self._conf.getContributionList())
        self.assert_( len(contribList) == 3 )
        self.assert_( contribList[0] == contrib1 )
        self.assert_( contribList[1] == contrib2 )
        self.assert_( contribList[2] == contrib3 )
        #Sorting by Date
        contrib1.setStartDate(datetime(2004, 5, 1, 10, 30,tzinfo=timezone('UTC')))
        contrib2.setStartDate(datetime(2003, 5, 1, 10, 30,tzinfo=timezone('UTC')))
        sortingCrit = contribFilters.SortingCriteria( ["date"] )
        f = SimpleFilter( None, sortingCrit )
        contribList = f.apply(self._conf.getContributionList())
        self.assert_( len(contribList) == 3 )
        self.assert_( contribList[0] == contrib2 )
        self.assert_( contribList[1] == contrib1 )
        self.assert_( contribList[2] == contrib3 )
        # Sorting by Contribution Type
        contribType1 = ContributionType("oral presentation", "no description", self._conf)
        contribType2 = ContributionType("poster", "no description", self._conf)
        contrib1.setType(contribType1)
        contrib2.setType(contribType2)
        sortingCrit = contribFilters.SortingCriteria( ["type"] )
        f = SimpleFilter( None, sortingCrit )
        contribList = f.apply(self._conf.getContributionList())
        self.assert_( len(contribList) == 3 )
        self.assert_( contribList[0] == contrib1 )
        self.assert_( contribList[1] == contrib2 )
        self.assert_( contribList[2] == contrib3 )
        # Sorting by Session
        session1 = Session()
        self._conf.addSession(session1)
        session2 = Session()
        self._conf.addSession(session2)
        contrib1.setSession(session1)
        contrib2.setSession(session2)
        sortingCrit = contribFilters.SortingCriteria( ["session"] )
        f = SimpleFilter( None, sortingCrit )
        contribList = f.apply(self._conf.getContributionList())
        self.assert_( len(contribList) == 3 )
        self.assert_(contrib1 in contribList)
        self.assert_(contrib2 in contribList)
        self.assert_(contrib3 in contribList)
        # Sorting by Track
        track1 = Track()
        track1.setTitle("3")
        track1.setConference(self._conf)
        track2 = Track()
        track2.setTitle("1")
        track2.setConference(self._conf)
        contrib1.setTrack(track1)
        contrib2.setTrack(track2)
        sortingCrit = contribFilters.SortingCriteria( ["track"] )
        f = SimpleFilter( None, sortingCrit )
        contribList = f.apply(self._conf.getContributionList())
        self.assert_( len(contribList) == 3 )
        self.assert_( contribList[0] == contrib2 )
        self.assert_( contribList[1] == contrib1 )
        self.assert_( contribList[2] == contrib3 )
开发者ID:lukasnellen,项目名称:indico,代码行数:85,代码来源:testWebInterface.py


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