本文整理汇总了Python中icalendar.parser.Contentlines.append方法的典型用法代码示例。如果您正苦于以下问题:Python Contentlines.append方法的具体用法?Python Contentlines.append怎么用?Python Contentlines.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类icalendar.parser.Contentlines
的用法示例。
在下文中一共展示了Contentlines.append方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testHmm
# 需要导入模块: from icalendar.parser import Contentlines [as 别名]
# 或者: from icalendar.parser.Contentlines import append [as 别名]
def testHmm(self):
from icalendar.parser import Contentlines, Contentline
c = Contentlines([Contentline('BEGIN:VEVENT\r\n')])
c.append(Contentline(''.join(['123456789 ']*10)+'\r\n'))
output = c.to_ical()
self.assertEqual(output,
'BEGIN:VEVENT\r\n\r\n123456789 123456789 123456789 123456789 123456789 123456789 123456789 1234\r\n 56789 123456789 123456789 \r\n')
示例2: test_main
# 需要导入模块: from icalendar.parser import Contentlines [as 别名]
# 或者: from icalendar.parser.Contentlines import append [as 别名]
def test_main(self, lines):
cl = Contentlines()
for key, params, value in lines:
params = Parameters(**params)
cl.append(Contentline.from_parts(key, params, value))
cl.append('')
assert Contentlines.from_ical(cl.to_ical()) == cl
示例3: content_lines
# 需要导入模块: from icalendar.parser import Contentlines [as 别名]
# 或者: from icalendar.parser.Contentlines import append [as 别名]
def content_lines(self):
"Converts the Component and subcomponents into content lines"
contentlines = Contentlines()
for name, values in self.property_items():
params = getattr(values, 'params', Parameters())
contentlines.append(Contentline.from_parts((name, params, values)))
contentlines.append('') # remember the empty string in the end
return contentlines
示例4: XtestLongLine
# 需要导入模块: from icalendar.parser import Contentlines [as 别名]
# 或者: from icalendar.parser.Contentlines import append [as 别名]
def XtestLongLine(self):
from icalendar.parser import Contentlines, Contentline
c = Contentlines([Contentline('BEGIN:VEVENT\\r\\n')])
c.append(Contentline(''.join(['123456789 ']*10)+'\\r\\n'))
import pdb ; pdb.set_trace()
output = str(c)
self.assertEqual(output,
"BEGIN:VEVENT\\r\\n\\r\\n123456789 123456789 123456789 123456789 123456789 123456789 123456789 1234\\r\\n 56789 123456789 123456789 \\r\\n")
示例5: XtestLongLine
# 需要导入模块: from icalendar.parser import Contentlines [as 别名]
# 或者: from icalendar.parser.Contentlines import append [as 别名]
def XtestLongLine(self):
from icalendar.parser import Contentlines, Contentline
c = Contentlines([Contentline('BEGIN:VEVENT\\r\\n')])
c.append(Contentline(''.join(['123456789 ']*10)+'\\r\\n'))
output = c.to_ical()
cmp = ("BEGIN:VEVENT\\r\\n\\r\\n123456789 123456789 123456789 "
"123456789 123456789 123456789 123456789 1234\\r\\n 56789 "
"123456789 123456789 \\r\\n")
self.assertEqual(output, cmp)
示例6: test_long_lines
# 需要导入模块: from icalendar.parser import Contentlines [as 别名]
# 或者: from icalendar.parser.Contentlines import append [as 别名]
def test_long_lines(self):
from icalendar.parser import Contentlines, Contentline
c = Contentlines([Contentline('BEGIN:VEVENT\r\n')])
c.append(Contentline(''.join('123456789 ' * 10) + '\r\n'))
self.assertEqual(
c.to_ical(),
'BEGIN:VEVENT\r\n\r\n123456789 123456789 123456789 123456789 '
'123456789 123456789 123456789 1234\r\n 56789 123456789 '
'123456789 \r\n\r\n'
)
示例7: testHmm
# 需要导入模块: from icalendar.parser import Contentlines [as 别名]
# 或者: from icalendar.parser.Contentlines import append [as 别名]
def testHmm(self):
from icalendar.parser import Contentlines, Contentline
c = Contentlines([Contentline("BEGIN:VEVENT\r\n")])
c.append(Contentline("".join(["123456789 "] * 10) + "\r\n"))
output = c.to_ical()
self.assertEqual(
output,
"BEGIN:VEVENT\r\n\r\n123456789 123456789 123456789 123456789 123456789 123456789 123456789 1234\r\n 56789 123456789 123456789 \r\n",
)
示例8: testHmm
# 需要导入模块: from icalendar.parser import Contentlines [as 别名]
# 或者: from icalendar.parser.Contentlines import append [as 别名]
def testHmm(self):
from icalendar.parser import Contentlines, Contentline
c = Contentlines([Contentline('BEGIN:VEVENT\r\n')])
c.append(Contentline(''.join(['123456789 ']*10)+'\r\n'))
output = c.to_ical()
# XXX: sure? looks weird in conjunction with generated content above.
#cmp = ('BEGIN:VEVENT\r\n\r\n123456789 123456789 123456789 123456789 '
# '123456789 123456789 123456789 1234\r\n 56789 123456789 '
# '123456789 \r\n')
cmp = ('BEGIN:VEVENT\r\n\r\n123456789 123456789 123456789 123456789 '
'123456789 123456789 123456789 \r\n 123456789 123456789 '
'123456789 \r\n\r\n')
self.assertEqual(output, cmp)