当前位置: 首页>>代码示例>>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;未经允许,请勿转载。