當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。