test_.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:ilovepdf 作者: sdelquin 项目源码 文件源码
def test_split():
    i = ILovePdf(config.PUBLIC_KEY, config.SECRET_KEY)
    i.new_task("split")
    i.add_file("test.pdf")
    i.execute(ranges="1-2,5-8")
    i.download()
    zip_ref = zipfile.ZipFile("out.zip", "r")
    zip_ref.extractall("test_split")
    zip_ref.close()
    assert len(glob.glob("test_split/*.pdf")) == 2
    output_file1 = PdfFileReader(open("test_split/test-1-2.pdf", "rb"))
    output_file2 = PdfFileReader(open("test_split/test-5-8.pdf", "rb"))
    assert output_file1.getNumPages() == 2
    assert output_file2.getNumPages() == 4
    os.remove("out.zip")
    shutil.rmtree("test_split")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号