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 = 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')
    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
 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)
 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)
 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 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",
        )
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)
Exemple #10
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 = 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)
Exemple #11
0
 def XtestTrailingNewline(self):
     from icalendar.parser import Contentlines, Contentline
     c = Contentlines([Contentline('BEGIN:VEVENT\\r\\n')])
     output = c.to_ical()
     self.assertEqual(output, 'BEGIN:VEVENT\\r\\n')
Exemple #12
0
 def XtestTrailingNewline(self):
     from icalendar.parser import Contentlines, Contentline
     c = Contentlines([Contentline('BEGIN:VEVENT\\r\\n')])
     output = c.to_ical()
     self.assertEqual(output, 'BEGIN:VEVENT\\r\\n')