Python DefaultTimeZone Example

说明

python defaulttimezone示例是从最受好评的开源项目中提取的实现代码,你可以参考下面示例的使用方式。

编程语言: Python

命名空间/包名称: osafpimcalendarTimeZone

示例#1
文件: TestTimeZone.py项目: HackLinux/chandler-1

 def testTimeZoneSaved(self):
     # Test case should:
     #
     # - Load the repo (Done in setUp())
     # - Get the repo's default DefaultTimeZone
     defaultTzItem = DefaultTimeZone.get(view=self.rep.view)
     # - Change the default DefaultTimeZone
     defaultTzItem.tzinfo = PyICU.ICUtzinfo.getInstance("GMT")
     self.failUnlessEqual(defaultTzItem.tzinfo,
             PyICU.ICUtzinfo.getInstance("GMT"))
     # - Save the repo
     self.rep.commit()
     self.rep.closeView()
     
     # - Change the DefaultTimeZone default timezone
     PyICU.TimeZone.adoptDefault(PyICU.TimeZone.createTimeZone("US/Pacific"))
     
     # - Reopen the repo
     self.rep.openView()
     self.manager = None
     
     # - Now check the default timezone
     defaultTzItem = DefaultTimeZone.get(view=self.rep.view)
     # ... see that it changed to what's in the repo
     self.failIfEqual(PyICU.ICUtzinfo.getInstance("US/Pacific"),
                     defaultTzItem.tzinfo)
     # ... and make sure it is still the default!
     self.failUnlessEqual(defaultTzItem.tzinfo, PyICU.ICUtzinfo.getDefault())

示例#2
文件: TestTimeZone.py项目: HackLinux/chandler-1

 def setUp(self):
     self.defaultTzItem = DefaultTimeZone.get()

示例#3
文件: TestTimeZone.py项目: HackLinux/chandler-1

 def testPerView(self):
     defaultTzItemOne = DefaultTimeZone.get(view=self.rep.view)
     defaultTzItemTwo = DefaultTimeZone.get()
     
     self.failIf(defaultTzItemOne is defaultTzItemTwo)

示例#4
文件: TestTimeZone.py项目: HackLinux/chandler-1

 def testGetTimeZone(self):
     defaultTzItem = DefaultTimeZone.get(view=self.rep.view)
     
     self.failUnlessEqual(defaultTzItem.tzinfo, PyICU.ICUtzinfo.getDefault())

展开阅读全文