PICARD-1762: fix broken PDF identification

In identify(), comparaison was done against `str` instead of `bytecode`, due to the lack of `b` prefix

ImageInfoTest: add missing test PDF file identification
This commit is contained in:
Laurent Monin
2020-02-22 16:16:49 +01:00
committed by Philipp Wolfer
parent 170b8e0aa7
commit 3585d40b0b
3 changed files with 10 additions and 1 deletions

View File

@@ -241,6 +241,15 @@ class ImageInfoTest(PicardTestCase):
(140, 96, 'image/jpeg', '.jpg', 8550)
)
def test_pdf(self):
file = os.path.join('test', 'data', 'mb.pdf')
with open(file, 'rb') as f:
self.assertEqual(
imageinfo.identify(f.read()),
(0, 0, 'application/pdf', '.pdf', 10362)
)
def test_not_enough_data(self):
self.assertRaises(imageinfo.IdentificationError,
imageinfo.identify, "x")