diff options
Diffstat (limited to 'tests/test_pdfstring.py')
-rw-r--r-- | tests/test_pdfstring.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/test_pdfstring.py b/tests/test_pdfstring.py new file mode 100644 index 0000000..4dcd2df --- /dev/null +++ b/tests/test_pdfstring.py @@ -0,0 +1,37 @@ +''' +Run from the directory above like so: +python -m tests.test_pdfstring +''' + + +import pdfrw +import unittest + + +class TestEncoding(unittest.TestCase): + + @staticmethod + def decode(value): + return pdfrw.pdfobjects.PdfString(value).decode() + + @staticmethod + def encode(value): + return str(pdfrw.pdfobjects.PdfString.encode(value)) + + @classmethod + def encode_decode(cls, value): + return cls.decode(cls.encode(value)) + + def roundtrip(self, value): + self.assertEqual(value, self.encode_decode(value)) + + def test_doubleslash(self): + self.roundtrip('\\') + + +def main(): + unittest.main() + + +if __name__ == '__main__': + main() |