本文整理汇总了Python中memacs.lib.orgformat.OrgFormat.inactive_datetime方法的典型用法代码示例。如果您正苦于以下问题:Python OrgFormat.inactive_datetime方法的具体用法?Python OrgFormat.inactive_datetime怎么用?Python OrgFormat.inactive_datetime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类memacs.lib.orgformat.OrgFormat
的用法示例。
在下文中一共展示了OrgFormat.inactive_datetime方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_inactive_date
# 需要导入模块: from memacs.lib.orgformat import OrgFormat [as 别名]
# 或者: from memacs.lib.orgformat.OrgFormat import inactive_datetime [as 别名]
def test_inactive_date(self):
"""
test Org inactive_date
"""
# testing tuples
t = time.strptime("2011-11-02T20:38", "%Y-%m-%dT%H:%M")
date = OrgFormat.inactive_date(t)
datetime = OrgFormat.inactive_datetime(t)
self.assertEqual("[2011-11-02 Wed]", date, "date error")
self.assertEqual("[2011-11-02 Wed 20:38]", datetime, "datetime error")
示例2: test_inactive_datetime
# 需要导入模块: from memacs.lib.orgformat import OrgFormat [as 别名]
# 或者: from memacs.lib.orgformat.OrgFormat import inactive_datetime [as 别名]
def test_inactive_datetime(self):
## fixed time with seconds:
self.assertEqual(
OrgFormat.inactive_datetime(time.struct_time([1980,12,31,23,59,58,0,0,0])),
u'[1980-12-31 Wed 23:59]' ) ## seconds are not (yet) defined in Org-mode
## fixed time without seconds:
self.assertEqual(
OrgFormat.inactive_datetime(time.struct_time([1980,12,31,23,59,0,0,0,0])),
u'[1980-12-31 Wed 23:59]' )
YYYYMMDDwday = time.strftime('%Y-%m-%d %a', time.localtime())
hhmmss = time.strftime('%H:%M', time.localtime()) ## seconds are not (yet) defined in Org-mode
## show_time parameter not named:
self.assertEqual(
OrgFormat.inactive_datetime(time.localtime()),
u'[' + YYYYMMDDwday + u' ' + hhmmss + u']' )
## show_time parameter named:
self.assertEqual(
OrgFormat.inactive_datetime(time.localtime()),
u'[' + YYYYMMDDwday + u' ' + hhmmss + u']' )
示例3: test_inactive_datetime
# 需要导入模块: from memacs.lib.orgformat import OrgFormat [as 别名]
# 或者: from memacs.lib.orgformat.OrgFormat import inactive_datetime [as 别名]
def test_inactive_datetime(self):
## fixed time with seconds:
self.assertEqual(
OrgFormat.inactive_datetime(time.struct_time([1980,12,31,23,59,58,0,0,0])),
u'[1980-12-31 Mon 23:59:58]' ) ## however, it was a Wednesday
## fixed time without seconds:
self.assertEqual(
OrgFormat.inactive_datetime(time.struct_time([1980,12,31,23,59,0,0,0,0])),
u'[1980-12-31 Mon 23:59]' ) ## however, it was a Wednesday
YYYYMMDDwday = time.strftime('%Y-%m-%d %a', time.localtime())
hhmmss = time.strftime('%H:%M:%S', time.localtime())
## show_time parameter not named:
self.assertEqual(
OrgFormat.inactive_datetime(time.localtime()),
u'[' + YYYYMMDDwday + u' ' + hhmmss + u']' )
## show_time parameter named:
self.assertEqual(
OrgFormat.inactive_datetime(time.localtime()),
u'[' + YYYYMMDDwday + u' ' + hhmmss + u']' )
示例4: test_inactive_date
# 需要导入模块: from memacs.lib.orgformat import OrgFormat [as 别名]
# 或者: from memacs.lib.orgformat.OrgFormat import inactive_datetime [as 别名]
def test_inactive_date(self):
"""
test Org inactive_date
"""
# testing time.struct_time
t = time.strptime("2011-11-02T20:38", "%Y-%m-%dT%H:%M")
mydate = OrgFormat.inactive_date(t)
mydatetime = OrgFormat.inactive_datetime(t)
self.assertEqual("[2011-11-02 Wed]", mydate, "mydate error")
self.assertEqual("[2011-11-02 Wed 20:38]", mydatetime, "mydatetime error")
# testing datetime.datetime
t = datetime.datetime(2018, 9, 22, hour=12, minute=55, second=59)
mydate = OrgFormat.inactive_date(t)
mydatetime = OrgFormat.inactive_date(t, show_time=True)
self.assertEqual("[2018-09-22 Sat]", mydate, "date error")
self.assertEqual("[2018-09-22 Sat 12:55]", mydatetime, "datetime error")