def test_escape_output(self): e = Event() e.name = "Hello, with \\ special; chars and \n newlines" e.location = "Here; too" e.description = "Every\nwhere ! Yes, yes !" e.created = arrow.Arrow(2013, 1, 1) e.uid = "empty-uid" eq = CRLF.join( ("BEGIN:VEVENT", "DTSTAMP:20130101T000000Z", "SUMMARY:Hello\\, with \\\\ special\\; chars and \\n newlines", "DESCRIPTION:Every\\nwhere ! Yes\\, yes !", "LOCATION:Here\\; too", "UID:empty-uid", "END:VEVENT")) self.assertEqual(str(e), eq)
def test_escapte_output(self): e = Event() e.name = "Hello, with \\ spechial; chars and \n newlines" e.location = "Here; too" e.description = "Every\nwhere ! Yes, yes !" e.created = arrow.Arrow(2013, 1, 1) e.uid = "empty-uid" eq = CRLF.join(("BEGIN:VEVENT", "DTSTAMP:20130101T000000Z", "SUMMARY:Hello\\, with \\\\ spechial\\; chars and \\n newlines", "DESCRIPTION:Every\\nwhere ! Yes\\, yes !", "LOCATION:Here\\; too", "UID:empty-uid", "END:VEVENT")) self.assertEqual(str(e), eq)
def test_escape_output(self): e = Event() e.name = "Hello, with \\ special; chars and \n newlines" e.location = "Here; too" e.description = "Every\nwhere ! Yes, yes !" e.dtstamp = dt(2013, 1, 1) e.uid = "empty-uid" eq = list( sorted([ "BEGIN:VEVENT", "DTSTAMP:20130101T000000", "DESCRIPTION:Every\\nwhere ! Yes\\, yes !", "LOCATION:Here\\; too", "SUMMARY:Hello\\, with \\\\ special\\; chars and \\n newlines", "UID:empty-uid", "END:VEVENT" ])) self.assertEqual(list(sorted(str(e).splitlines())), eq)
def test_escape_output(self): e = Event() e.name = "Hello, with \\ spechial; chars and \n newlines" e.location = "Here; too" e.description = "Every\nwhere ! Yes, yes !" e.created = datetime(2013, 1, 1, tzinfo=tzutc) e.uid = "empty-uid" output = str(e).splitlines() self.assertEqual(output[0], "BEGIN:VEVENT") self.assertEqual(output[-1], "END:VEVENT") eq = set(("DTSTAMP:20130101T000000Z", "SUMMARY:Hello\\, with \\\\ spechial\\; chars and \\n newlines", "DESCRIPTION:Every\\nwhere ! Yes\\, yes !", "LOCATION:Here\\; too", "UID:empty-uid")) self.assertEqual(set(output[1:-1]), eq)