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


Python Conference.getAuthorIndex方法代碼示例

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


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

示例1: TestWithdrawal

# 需要導入模塊: from MaKaC.conference import Conference [as 別名]
# 或者: from MaKaC.conference.Conference import getAuthorIndex [as 別名]
class TestWithdrawal(unittest.TestCase):
    """Tests different scenarios concerning the contribution withdrawal
    """

    def setUp( self ):
        self._creator=Avatar()
        self._creator.setId("creator")
        self._conf=Conference(self._creator)
        self._conf.setTimezone('UTC')
        sd=datetime(2004, 01, 01, 10, 00, tzinfo=timezone("UTC"))
        ed=datetime(2004, 01, 05, 10, 00, tzinfo=timezone("UTC"))
        self._conf.setDates(sd,ed)

    def testBasicWithdrawal(self):
        c1,c2=Contribution(),Contribution()
        auth1,auth2=ContributionParticipation(),ContributionParticipation()
        self._conf.addContribution(c1)
        self._conf.addContribution(c2)
        auth1.setFirstName("a")
        auth1.setFamilyName("a")
        auth1.setEmail("a")
        auth2.setFirstName("b")
        auth2.setFamilyName("b")
        auth2.setEmail("b")
        c1.addPrimaryAuthor(auth1)
        c2.addPrimaryAuthor(auth2)
        s1=Session()
        sd=datetime(2004, 01, 01, 12, 00, tzinfo=timezone("UTC"))
        ed=datetime(2004, 01, 01, 19, 00, tzinfo=timezone("UTC"))
        s1.setDates(sd,ed)
        slot1=SessionSlot(s1)
        self._conf.addSession(s1)
        s1.addSlot(slot1)
        s1.addContribution(c1)
        s1.addContribution(c2)
        slot1.getSchedule().addEntry(c1.getSchEntry())
        slot1.getSchedule().addEntry(c2.getSchEntry())
        self.assert_(c1.isScheduled())
        self.assert_(c2.isScheduled())
        authIdx=self._conf.getAuthorIndex()
        self.assert_(auth1 in authIdx.getParticipations()[0])
        self.assert_(auth2 in authIdx.getParticipations()[1])
        c1.withdraw(self._creator,"test")
        self.assert_(not c1.isScheduled())
        self.assert_(c2.isScheduled())
        self.assert_(auth1 not in authIdx.getParticipations()[0])
        self.assert_(auth2 in authIdx.getParticipations()[0])
        auth1.setFirstName("aa")
        self.assert_(auth1 not in authIdx.getParticipations()[0])
        self.assert_(auth2 in authIdx.getParticipations()[0])
        auth3,auth4=ContributionParticipation(),ContributionParticipation()
        auth3.setFirstName("c")
        auth3.setFamilyName("c")
        auth3.setEmail("c")
        auth4.setFirstName("d")
        auth4.setFamilyName("d")
        auth4.setEmail("d")
        c1.addPrimaryAuthor(auth3)
        c2.addPrimaryAuthor(auth4)
        self.assert_(auth2 in authIdx.getParticipations()[0])
        self.assert_(auth4 in authIdx.getParticipations()[1])
        self.assertRaises(MaKaCError,slot1.getSchedule().addEntry,c1.getSchEntry())
開發者ID:lukasnellen,項目名稱:indico,代碼行數:64,代碼來源:testContributions.py

示例2: TestAuthorIndex

# 需要導入模塊: from MaKaC.conference import Conference [as 別名]
# 或者: from MaKaC.conference.Conference import getAuthorIndex [as 別名]
class TestAuthorIndex(unittest.TestCase):
    """Tests the author index
    """

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

    def testBasicIndexing(self):
        #Tests adding a contribution with some authors already on it
        c1=Contribution()
        self._conf.addContribution(c1)
        auth1,auth2=ContributionParticipation(),ContributionParticipation()
        auth1.setFirstName("hector")
        auth1.setFamilyName("sanchez sanmartin")
        auth1.setEmail("[email protected]")
        auth2.setFirstName("jose benito")
        auth2.setFamilyName("gonzalez lopez")
        auth2.setEmail("[email protected]")
        c1.addPrimaryAuthor(auth1)
        c1.addPrimaryAuthor(auth2)
        idx=self._conf.getAuthorIndex()
        self.assert_(auth1 in idx.getParticipations()[1])
        self.assert_(len(idx.getParticipations()[1])==1)
        self.assert_(auth2 in idx.getParticipations()[0])
        self.assert_(len(idx.getParticipations()[0])==1)
        c2=Contribution()
        self._conf.addContribution(c2)
        auth3,auth4=ContributionParticipation(),ContributionParticipation()
        auth3.setFirstName("hector")
        auth3.setFamilyName("sanchez sanmartin")
        auth3.setEmail("[email protected]")
        auth4.setFirstName("jose benito")
        auth4.setFamilyName("gonzalez lopez2")
        auth4.setEmail("[email protected]")
        c2.addPrimaryAuthor(auth3)
        c2.addPrimaryAuthor(auth4)
        #Tests removing a contribution from a conference updates the author 
        #   index correctly
        #self.assert_(auth3 in idx.getParticipations()[2])
        #self.assert_(len(idx.getParticipations()[2])==2)
        #self.assert_(auth4 in idx.getParticipations()[1])
        #self.assert_(len(idx.getParticipations()[1])==1)
        #self._conf.removeContribution(c2)
        #self.assert_(auth1 in idx.getParticipations()[1])
        #self.assert_(len(idx.getParticipations()[1])==1)
        #self.assert_(auth2 in idx.getParticipations()[0])
        #self.assert_(len(idx.getParticipations()[0])==1)
        #Tests adding additional authors to a contribution which is already
        #   included in a conference updates the author index correctly
        #auth5=ContributionParticipation()
        #auth5.setFirstName("jean-yves")
        #auth5.setFamilyName("le meur")
        #auth5.setEmail("[email protected]")
        #c1.addPrimaryAuthor(auth5)
        #self.assert_(auth1 in idx.getParticipations()[2])
        #self.assert_(len(idx.getParticipations()[2])==1)
        #self.assert_(auth2 in idx.getParticipations()[0])
        #self.assert_(len(idx.getParticipations()[0])==1)
        #self.assert_(auth5 in idx.getParticipations()[1])
        #self.assert_(len(idx.getParticipations()[1])==1)
        #Tests removing authors from a contribution which is already
        #   included in a conference updates the author index correctly
        #c1.removePrimaryAuthor(auth5)
        #self.assert_(auth1 in idx.getParticipations()[1])
        #self.assert_(len(idx.getParticipations()[1])==1)
        #self.assert_(auth2 in idx.getParticipations()[0])
        #self.assert_(len(idx.getParticipations()[0])==1)

    def testChangesInAuthorData(self):
        #Checks that changes in the author data updates the author index 
        #   correctly
        c1=Contribution()
        self._conf.addContribution(c1)
        auth1,auth2=ContributionParticipation(),ContributionParticipation()
        auth1.setFirstName("zFN")
        auth1.setFamilyName("zSN")
        auth1.setEmail("zM")
        auth2.setFirstName("AFN")
        auth2.setFamilyName("ASN")
        auth2.setEmail("aM")
        c1.addPrimaryAuthor(auth1)
        c1.addPrimaryAuthor(auth2)
        
        idx=self._conf.getAuthorIndex()
        self.assert_(auth1 in idx.getParticipations()[1])
        self.assert_(len(idx.getParticipations()[1])==1)
        self.assert_(auth2 in idx.getParticipations()[0])
        self.assert_(len(idx.getParticipations()[0])==1)
        auth2.setFamilyName("ZZSN")
        self.assert_(auth1 in idx.getParticipations()[0])
        self.assert_(len(idx.getParticipations()[0])==1)
        self.assert_(auth2 in idx.getParticipations()[1])
        self.assert_(len(idx.getParticipations()[1])==1)
開發者ID:lukasnellen,項目名稱:indico,代碼行數:101,代碼來源:testConferences.py


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