本文整理匯總了Python中MaKaC.conference.Conference.addOwner方法的典型用法代碼示例。如果您正苦於以下問題:Python Conference.addOwner方法的具體用法?Python Conference.addOwner怎麽用?Python Conference.addOwner使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MaKaC.conference.Conference
的用法示例。
在下文中一共展示了Conference.addOwner方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _Needs_Rewriting_TestTimeSchedule
# 需要導入模塊: from MaKaC.conference import Conference [as 別名]
# 或者: from MaKaC.conference.Conference import addOwner [as 別名]
class _Needs_Rewriting_TestTimeSchedule(unittest.TestCase):
"""Tests the basic schedule management functions
"""
def setUp( self ):
a = Avatar()
a.setId("creator")
self._conf = Conference( a )
self._conf.setId('a')
category=Category()
category.setId('1')
self._conf.addOwner(category)
catDateIdx = indexes.IndexesHolder().getIndex('categoryDate')
catDateIdx.indexConf(self._conf)
self._conf.setTimezone('UTC')
#TODO We need somehow to link schOwner with self._conf (Same thing for the following test
# def testBasicAddAndRemove( self ):
# from MaKaC.schedule import TimeSchedule
# sDateSch,eDateSch=datetime(2004,1,1,10,0, tzinfo=timezone('UTC')),datetime(2004,1,1,12,0, tzinfo=timezone('UTC'))
# schOwner=_ScheduleOwnerWrapper(sDateSch,eDateSch)
# sch=TimeSchedule(schOwner)
# self._conf.addOwner(sch)
# entry1=IndTimeSchEntry()
# entry1.setDuration(0,25)
# entry2=IndTimeSchEntry()
# entry2.setDuration(0,30)
# entry3=IndTimeSchEntry()
# self.assert_(not entry1.isScheduled())
# self.assert_(not entry2.isScheduled())
# self.assert_(not entry3.isScheduled())
# sch.addEntry(entry1)
# sch.addEntry(entry2)
# sch.addEntry(entry3)
# self.assert_(entry1.isScheduled())
# self.assert_(entry2.isScheduled())
# self.assert_(entry3.isScheduled())
# self.assert_(entry1==sch.getEntries()[0])
# self.assert_(entry2==sch.getEntries()[1])
# self.assert_(entry3==sch.getEntries()[2])
# self.assert_(entry1.getStartDate()==datetime(2004,1,1,10,0, tzinfo=timezone('UTC')))
# self.assert_(entry1.getDuration()==timedelta(minutes=25))
# self.assert_(entry2.getStartDate()==datetime(2004,1,1,10,25, tzinfo=timezone('UTC')))
# self.assert_(entry2.getDuration()==timedelta(minutes=30))
# self.assert_(entry3.getStartDate()==datetime(2004,1,1,10,55, tzinfo=timezone('UTC')))
# self.assert_(entry3.getDuration()==timedelta(minutes=5))
# sch.removeEntry(entry1)
# self.assert_(not entry1.isScheduled())
# self.assert_(entry2.isScheduled())
# self.assert_(entry3.isScheduled())
# self.assert_(entry1 not in sch.getEntries())
# self.assert_(entry2==sch.getEntries()[0])
# self.assert_(entry3==sch.getEntries()[1])
# self.assert_(entry1.getDuration()==timedelta(minutes=25))
# self.assert_(entry2.getStartDate()==datetime(2004,1,1,10,25, tzinfo=timezone('UTC')))
# self.assert_(entry2.getDuration()==timedelta(minutes=30))
# self.assert_(entry3.getStartDate()==datetime(2004,1,1,10,55, tzinfo=timezone('UTC')))
# self.assert_(entry3.getDuration()==timedelta(minutes=5))
# def testCompact(self):
# from MaKaC.schedule import TimeSchedule
# sDateSch=datetime(2004, 01, 01, 10, 00, tzinfo=timezone('UTC'))
# eDateSch=datetime(2004, 01, 01, 12, 00, tzinfo=timezone('UTC'))
# schOwner=_ScheduleOwnerWrapper(sDateSch,eDateSch)
# sch=TimeSchedule(schOwner)
# from MaKaC.schedule import TimeSchEntry
# entry1,entry2=IndTimeSchEntry(),IndTimeSchEntry()
# entry3=IndTimeSchEntry()
# entry1.setDuration(0,25)
# entry2.setDuration(0,25)
# entry3.setDuration(0,30)
# sch.addEntry(entry1)
# self.assert_(entry1.getStartDate()==datetime(2004, 01, 01, 10, 00, tzinfo=timezone('UTC')))
# sch.addEntry(entry2)
# self.assert_(entry2.getStartDate()==datetime(2004, 01, 01, 10, 25, tzinfo=timezone('UTC')))
# sch.addEntry(entry3)
# self.assert_(entry3.getStartDate()==datetime(2004, 01, 01, 10, 50, tzinfo=timezone('UTC')))
# entry1.setStartDate(datetime(2004, 01, 01, 11, 00, tzinfo=timezone('UTC')))
# entry2.setStartDate(datetime(2004, 01, 01, 11, 15, tzinfo=timezone('UTC')))
# entry3.setStartDate(datetime(2004, 01, 01, 11, 25, tzinfo=timezone('UTC')))
# self.assert_(entry1.getStartDate()==datetime(2004, 01, 01, 11, 00, tzinfo=timezone('UTC')))
# self.assert_(entry2.getStartDate()==datetime(2004, 01, 01, 11, 15, tzinfo=timezone('UTC')))
# self.assert_(entry3.getStartDate()==datetime(2004, 01, 01, 11, 25, tzinfo=timezone('UTC')))
# sch.compact()
# self.assert_(entry1.getStartDate()==datetime(2004 ,01, 01, 10, 00, tzinfo=timezone('UTC')))
# self.assert_(entry1.getDuration()==timedelta(minutes=25))
# self.assert_(entry2.getStartDate()==datetime(2004, 01, 01, 10, 25, tzinfo=timezone('UTC')))
# self.assert_(entry2.getDuration()==timedelta(minutes=25))
# self.assert_(entry3.getStartDate()==datetime(2004, 01, 01, 10, 50, tzinfo=timezone('UTC')))
# self.assert_(entry3.getDuration()==timedelta(minutes=30))
def testStartEndDates(self):
from MaKaC.schedule import TimeSchedule
sDateSch,eDateSch=datetime(2004,1,1,10,0, tzinfo=timezone('UTC')),datetime(2004,1,1,12,0, tzinfo=timezone('UTC'))
schOwner=_ScheduleOwnerWrapper(sDateSch,eDateSch)
sch=TimeSchedule(schOwner)
self.assert_(sch.getStartDate()==schOwner.getStartDate())
self.assert_(sch.getEndDate()==schOwner.getEndDate())
schOwner.setStartDate(datetime(2004, 01, 02, 10, 00, tzinfo=timezone('UTC')))