added support for ignore bad char flag
- updated unit tests to include - using the textstate.to_unichr abstraction
This commit is contained in:
1 parent
841576d9b8
commit
a29d465ea4
9 files changed
+53
-11
No files matched your search
Binary file not shown.
@@ -0,0 +1,23 @@
|
||||
from pathlib import Path
|
||||
from unittest import TestCase, main
|
||||
|
||||
from pdfmajor.interpreter import PDFInterpreter, exceptions
|
||||
|
||||
CURRENT_FOLDER = Path("./")
|
||||
|
||||
class BadUnicode(TestCase):
|
||||
def test_ensure_failure(self):
|
||||
pdf = PDFInterpreter(CURRENT_FOLDER / "tests" / "samples" / "pdf" / "bad-unicode.pdf", ignore_bad_chars=False)
|
||||
pages = list(pdf)
|
||||
with self.assertRaises(exceptions.PDFUnicodeNotDefined):
|
||||
list(pages[2])
|
||||
|
||||
def test_ensure_no_failure(self):
|
||||
pdf = PDFInterpreter(CURRENT_FOLDER / "tests" / "samples" / "pdf" / "bad-unicode.pdf", ignore_bad_chars=True)
|
||||
pages = list(pdf)
|
||||
list(pages[2])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Run Tests
|
||||
main()
|
||||
Reference in new issue
Block a user