예제 #1
0
 def test_open_from_corrupted_bytes_throws_error(self):
     with self.assertRaisesRegexp(ValueError, 'invalid pdf file'):
         PDFDocument.frombytes(b'foo')
예제 #2
0
 def test_open_from_buffer(self):
     with open('tests/assets/1page.pdf', 'rb') as f:
         doc = PDFDocument.frombytes(f.read())
         self.assertIsNotNone(doc)
         self.assertEqual(len(doc), 1)