def test_continuation(self): # See PDF 1.7 ref section 3.2 page 55 s1 = PdfString('(These two strings are the same.)') self.assertEqual(s1.decode(), s1[1:-1]) s2 = PdfString('(These \\\ntwo strings \\\nare the same.)') self.assertEqual(s1.decode(), s2.decode()) s2 = PdfString(s2.replace('\n', '\r')) self.assertEqual(s1.decode(), s2.decode()) s2 = PdfString(s2.replace('\r', '\r\n')) self.assertEqual(s1.decode(), s2.decode())
def decode(self, value): s = PdfString(value) x = s.to_unicode() y = s.decode() self.assertEqual(x, y) return x