本文整理汇总了Python中memacs.lib.orgformat.OrgFormat类的典型用法代码示例。如果您正苦于以下问题:Python OrgFormat类的具体用法?Python OrgFormat怎么用?Python OrgFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OrgFormat类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_contact_mail_mailto_link
def test_contact_mail_mailto_link(self):
mail_link1 = OrgFormat.contact_mail_mailto_link(
"Bob Bobby <[email protected]>")
mail_link2 = OrgFormat.contact_mail_mailto_link("<[email protected]>")
self.assertEqual("[[mailto:[email protected]][Bob Bobby]]",
mail_link1)
self.assertEqual("[[mailto:[email protected]][[email protected]]]",
mail_link2)
开发者ID:novoid,项目名称:Memacs,代码行数:8,代码来源:orgformat_test.py
示例2: test_strings
def test_strings(self):
# testing strings
self.assertEqual("<2011-11-03 Thu>",
OrgFormat.strdate("2011-11-3"),
"date string error")
self.assertEqual("<2011-11-03 Thu 11:52>",
OrgFormat.strdatetime("2011-11-3 11:52"),
"datetime string error")
开发者ID:novoid,项目名称:Memacs,代码行数:8,代码来源:orgformat_test.py
示例3: test_contact_mail_mailto_link
def test_contact_mail_mailto_link(self):
self.assertEqual(
OrgFormat.contact_mail_mailto_link("<[email protected]>"),
u"[[mailto:[email protected]][[email protected]]]" )
self.assertEqual(
OrgFormat.contact_mail_mailto_link("Bob Bobby <[email protected]>"),
u"[[mailto:[email protected]][Bob Bobby]]" )
开发者ID:andrewjss,项目名称:Memacs,代码行数:9,代码来源:orgformat_test.py
示例4: test_newsgroup_link
def test_newsgroup_link(self):
self.assertEqual(
OrgFormat.newsgroup_link("foo"),
u"[[news:foo][foo]]" )
self.assertEqual(
OrgFormat.newsgroup_link("foo.bar.baz"),
u"[[news:foo.bar.baz][foo.bar.baz]]" )
开发者ID:andrewjss,项目名称:Memacs,代码行数:9,代码来源:orgformat_test.py
示例5: test_link
def test_link(self):
"""
test Org links
"""
self.assertEqual(
"[[/link/][description]]", OrgFormat.link("/link/", "description"), "format error link+description"
)
self.assertEqual("[[/link/]]", OrgFormat.link("/link/"), "format error link")
self.assertEqual("[[/link%20link/]]", OrgFormat.link("/link link/"), "quote error")
开发者ID:njagadeesh,项目名称:Memacs,代码行数:9,代码来源:orgformat_test.py
示例6: test_datetupleiso8601
def test_datetupleiso8601(self):
self.assertEqual(
OrgFormat.datetupeliso8601('1980-12-31'),
time.struct_time([1980, 12, 31,
0, 0, 0,
2, 366, -1]) )
with self.assertRaises(TimestampParseException):
OrgFormat.datetupeliso8601('1980-12-31T23.59'),
开发者ID:andrewjss,项目名称:Memacs,代码行数:10,代码来源:orgformat_test.py
示例7: test_inactive_date
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")
开发者ID:njagadeesh,项目名称:Memacs,代码行数:10,代码来源:orgformat_test.py
示例8: test_date
def test_date(self):
"""
test Org date
"""
# testing tuples
t = time.strptime("2011-11-02T20:38", "%Y-%m-%dT%H:%M")
date = OrgFormat.date(t)
datetime = OrgFormat.date(t, show_time=True)
self.assertEqual("<2011-11-02 Wed>", date, "date error")
self.assertEqual("<2011-11-02 Wed 20:38>", datetime, "datetime error")
开发者ID:njagadeesh,项目名称:Memacs,代码行数:10,代码来源:orgformat_test.py
示例9: test_iso8601
def test_iso8601(self):
# testing iso8601
self.assertEqual("<2011-11-30 Wed 21:06>",
OrgFormat.strdatetimeiso8601("2011-11-30T21.06"),
"datetimeiso8601 error")
self.assertEqual("<2011-11-30 Wed 21:06>",
OrgFormat.strdatetimeiso8601("2011-11-30T21.06.00"),
"datetimeiso8601 error")
self.assertEqual("<2011-11-30 Wed 21:06:02>",
OrgFormat.strdatetimeiso8601("2011-11-30T21.06.02"),
"datetimeiso8601 error")
开发者ID:Daniel1234,项目名称:Memacs,代码行数:11,代码来源:orgformat_test.py
示例10: test_strdate
def test_strdate(self):
self.assertEqual(
OrgFormat.strdate('1980-12-31'),
u'<1980-12-31 Wed>' )
self.assertEqual(
OrgFormat.strdate('1981-01-15'),
u'<1981-01-15 Thu>' )
with self.assertRaises(TimestampParseException):
OrgFormat.strdate('1981-01-15foo'),
开发者ID:ajft,项目名称:Memacs,代码行数:12,代码来源:orgformat_test.py
示例11: test_strdatetimeiso8601
def test_strdatetimeiso8601(self):
self.assertEqual(
OrgFormat.strdatetimeiso8601('1980-12-31T23.59'),
u'<1980-12-31 Wed 23:59>' )
self.assertEqual(
OrgFormat.strdatetimeiso8601('1981-01-15T15.10.23'),
u'<1981-01-15 Thu 15:10:23>' )
with self.assertRaises(TimestampParseException):
OrgFormat.strdatetimeiso8601('1981-01-15T15:10')
开发者ID:ajft,项目名称:Memacs,代码行数:12,代码来源:orgformat_test.py
示例12: test_strdatetimeiso8601
def test_strdatetimeiso8601(self):
self.assertEqual(
OrgFormat.strdatetimeiso8601('1980-12-31T23.59'),
u'<1980-12-31 Wed 23:59>' )
self.assertEqual(
OrgFormat.strdatetimeiso8601('1981-01-15T15.10.23'),
u'<1981-01-15 Thu 15:10>' ) ## seconds are not (yet) defined in Org-mode
with self.assertRaises(TimestampParseException):
OrgFormat.strdatetimeiso8601('1981-01-15T15:10')
开发者ID:andrewjss,项目名称:Memacs,代码行数:12,代码来源:orgformat_test.py
示例13: test_iso8601_datetupel
def test_iso8601_datetupel(self):
self.assertEqual(
2011,
OrgFormat.datetupeliso8601("2011-11-30").tm_year,
"datetimeiso8601 error")
self.assertEqual(
11,
OrgFormat.datetupeliso8601("2011-11-30").tm_mon,
"datetimeiso8601 error")
self.assertEqual(
30,
OrgFormat.datetupeliso8601("2011-11-30").tm_mday,
"datetimeiso8601 error")
开发者ID:novoid,项目名称:Memacs,代码行数:13,代码来源:orgformat_test.py
示例14: test_apply_timedelta_to_Orgmode_timestamp
def test_apply_timedelta_to_Orgmode_timestamp(self):
self.assertEqual(
OrgFormat.apply_timedelta_to_Orgmode_timestamp(u"<1980-12-31 Wed 23:59>", +2),
u"<1981-01-01 Thu 01:59>" )
self.assertEqual(
OrgFormat.apply_timedelta_to_Orgmode_timestamp(u"<1981-01-01 Thu 01:59>", -2),
u"<1980-12-31 Wed 23:59>" )
self.assertEqual(
OrgFormat.apply_timedelta_to_Orgmode_timestamp(u"<2009-12-07 Mon 12:25>-<2009-12-07 Mon 12:26>", -2),
u"<2009-12-07 Mon 10:25>-<2009-12-07 Mon 10:26>" )
开发者ID:andrewjss,项目名称:Memacs,代码行数:13,代码来源:orgformat_test.py
示例15: test_datetupelutctimestamp
def test_datetupelutctimestamp(self):
self.assertEqual(
OrgFormat.datetupelutctimestamp('19801231'),
time.struct_time([1980, 12, 31,
0, 0, 0,
2, 366, -1]) )
self.assertEqual(
OrgFormat.datetupelutctimestamp('19801231T235958'),
time.struct_time([1980, 12, 31,
23, 59, 58,
2, 366, -1]) )
开发者ID:andrewjss,项目名称:Memacs,代码行数:13,代码来源:orgformat_test.py
示例16: test_datetimetupeliso8601
def test_datetimetupeliso8601(self):
self.assertEqual(
OrgFormat.datetimetupeliso8601('1980-12-31T23.59'),
time.struct_time([1980, 12, 31,
23, 59, 0,
2, 366, -1]) )
self.assertEqual(
OrgFormat.datetimetupeliso8601('1980-12-31T23.59.58'),
time.struct_time([1980, 12, 31,
23, 59, 58,
2, 366, -1]) )
开发者ID:andrewjss,项目名称:Memacs,代码行数:13,代码来源:orgformat_test.py
示例17: test_link
def test_link(self):
self.assertEqual(
OrgFormat.link("http://github.org/novoid/memacs"),
u'[[http://github.org/novoid/memacs]]')
self.assertEqual(
OrgFormat.link("http://github.org/novoid/memacs with space"),
u'[[http://github.org/novoid/memacs%20with%20space]]')
self.assertEqual(
OrgFormat.link("http://github.org/novoid/memacs", "Memacs Repository"),
u'[[http://github.org/novoid/memacs][Memacs Repository]]')
开发者ID:andrewjss,项目名称:Memacs,代码行数:13,代码来源:orgformat_test.py
示例18: test_daterange
def test_daterange(self):
## fixed time with seconds:
self.assertEqual(
OrgFormat.daterange(
time.struct_time([1980,12,31,23,59,58,0,0,0]),
time.struct_time([1981,1,15,15,30,02,0,0,0]),
),
u'<1980-12-31 Wed>--<1981-01-15 Thu>' )
## provoke error:
with self.assertRaises(AssertionError):
OrgFormat.daterange('foo', 42)
开发者ID:andrewjss,项目名称:Memacs,代码行数:13,代码来源:orgformat_test.py
示例19: test_utc_time
def test_utc_time(self):
os.environ['TZ'] = "Europe/Vienna"
time.tzset()
self.assertEqual(
OrgFormat.date(
OrgFormat.datetupelutctimestamp("20111219T205510Z"), True
),
"<2011-12-19 Mon 21:55>"
)
self.assertEqual(
OrgFormat.date(
OrgFormat.datetupelutctimestamp("20111219T205510"),
True
),
"<2011-12-19 Mon 20:55>")
self.assertEqual(
OrgFormat.date(OrgFormat.datetupelutctimestamp("20111219"), False),
"<2011-12-19 Mon>"
)
self.assertEqual(
OrgFormat.date(OrgFormat.datetupelutctimestamp("18991230"), False),
"<1899-12-30 Sat>"
)
开发者ID:novoid,项目名称:Memacs,代码行数:27,代码来源:orgformat_test.py
示例20: test_autotag
def test_autotag(self):
test_filename = self.TMPFOLDER + "testautotag.org"
autotag_dict = {}
autotag_dict["TUG"] = ["tugraz", "university"]
autotag_dict["programming"] = ["programming", "python", "java"]
output = "Programming for my bachelor thesis at University"
# writing test output
writer = OrgOutputWriter(short_description="short-des",
tag="tag",
file_name=test_filename,
autotag_dict=autotag_dict)
timestamp = OrgFormat.datetime(time.gmtime(0))
properties = OrgProperties("data_for_hashing")
writer.write_org_subitem(timestamp=timestamp,
output=output,
properties=properties)
writer.close()
# read and check the file_handler
file_handler = codecs.open(test_filename, "r", "utf-8")
input_handler = file_handler.readlines()
file_handler.close()
self.assertEqual(input_handler[4],
u"** <1970-01-01 Thu 00:00> Programming for my " + \
"bachelor thesis at University\t:programming:TUG:\n")
#cleaning up
os.remove(self.TMPFOLDER + "testautotag.org")
开发者ID:Daniel1234,项目名称:Memacs,代码行数:34,代码来源:orgwriter_test.py
注:本文中的memacs.lib.orgformat.OrgFormat类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论