def test_pdf_embedded(): assert f("pdf_docm.pdf").magic.startswith("PDF document") m = PdfFile(f("pdf_docm.pdf")) assert m.handles() is True assert m.f.selected files = list(m.unpack()) assert m.f.extension == "pdf" assert len(files) == 1 assert not files[0].filepath assert files[0].filename == "Q6TCWXPS.docm" assert files[0].filesize == 55494 assert files[0].extension == "docm" assert files[0].selected assert len(files[0].children) == 18
def test_garbage(): m = PdfFile(f("garbage.bin")) assert m.handles() is False assert not m.f.selected assert not m.unpack()
def test_pdf_magic(): m = PdfFile(File(contents=f("pdf_docm.pdf").contents)) assert m.handles() is True
def test_bypass_minimized(): m = PdfFile(f(b"bypass_minimized.pdf")) files = list(m.unpack()) assert len(files) == 1 assert files[0].filename == b"test.txt"