本文整理汇总了Python中epsilon.extime.Time.fromDatetime方法的典型用法代码示例。如果您正苦于以下问题:Python Time.fromDatetime方法的具体用法?Python Time.fromDatetime怎么用?Python Time.fromDatetime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类epsilon.extime.Time
的用法示例。
在下文中一共展示了Time.fromDatetime方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_getValue
# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromDatetime [as 别名]
def test_getValue(self):
"""
L{methanal.view.DateInput.getValue} retrieves an empty string in the
C{None} case and a string representing the C{Time} specified by
parameter's value, in the case where a value exists.
"""
control = self.createControl(dict(timezone=FixedOffset(0, 0)))
param = control.parent.param
param.value = None
self.assertEquals(control.getValue(), u"")
param.value = Time.fromDatetime(datetime(2007, 1, 1))
self.assertTrue(isinstance(control.getValue(), unicode))
self.assertEquals(control.getValue(), u"2007-01-01")
param.value = Time.fromDatetime(datetime(542, 12, 18))
self.assertEquals(control.getValue(), u"0542-12-18")
示例2: setUp
# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromDatetime [as 别名]
def setUp(self):
"""
Create a handful of messages spread out over a brief time period so
that tests can assert things about methods which operate on messages.
"""
self.store = Store()
inboxItem = Inbox(store=self.store)
installOn(inboxItem, self.store)
self.privateApplication = inboxItem.privateApplication
self.webTranslator = IWebTranslator(self.store)
baseTime = datetime(year=2001, month=3, day=6)
self.msgs = []
for i in xrange(5):
self.msgs.append(
testMessageFactory(store=self.store,
read=False,
spam=False,
receivedWhen=Time.fromDatetime(
baseTime + timedelta(seconds=i))))
self.inbox = InboxScreen(inboxItem)
示例3: parse
# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromDatetime [as 别名]
def parse(timeString):
return Time.fromDatetime(_parse(timeString))
示例4: getTimestamp
# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromDatetime [as 别名]
def getTimestamp(self):
return Time.fromDatetime(datetime.now().replace(hour=0,
minute=0, second=0)
).asPOSIXTimestamp()