本文整理汇总了Python中memacs.lib.orgformat.OrgFormat类的典型用法代码示例。如果您正苦于以下问题:Python OrgFormat类的具体用法?Python OrgFormat怎么用?Python OrgFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OrgFormat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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")
示例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]]" )
示例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]]" )
示例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")
示例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'),
示例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")
示例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")
示例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")
示例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'),
示例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')
示例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')
示例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")
示例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>" )
示例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]) )