Exemple #1
0
 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 = 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')
    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
Exemple #3
0
 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
Exemple #4
0
 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")
Exemple #5
0
 def content_lines(self, sorted=True):
     """Converts the Component and subcomponents into content lines.
     """
     contentlines = Contentlines()
     for name, value in self.property_items(sorted=sorted):
         cl = self.content_line(name, value, sorted=sorted)
         contentlines.append(cl)
     contentlines.append('')  # remember the empty string in the end
     return contentlines
 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')
 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)
Exemple #8
0
    def test_main(self, lines):
        cl = Contentlines()
        for key, params, value in lines:
            try:
                params = Parameters(**params)
            except TypeError:
                # Happens when there is a random parameter 'self'...
                continue
            cl.append(Contentline.from_parts(key, params, value))
        cl.append('')

        assert Contentlines.from_ical(cl.to_ical()) == cl
 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)
 def XtestTrailingNewline(self):
     from icalendar.parser import Contentlines, Contentline
     c = Contentlines([Contentline('BEGIN:VEVENT\\r\\n')])
     output = str(c)
     self.assertEqual(output, 'BEGIN:VEVENT\\r\\n')