def test_write_images(): wb = Workbook() ew = ExcelWriter(workbook=wb) from openpyxl.drawing import Image imagepath = os.path.join(DATADIR, "plain.png") img = Image(imagepath) buf = BytesIO() archive = zipfile.ZipFile(buf, 'w') ew._write_images([img], archive, 1) archive.close() buf.seek(0) archive = zipfile.ZipFile(buf, 'r') zipinfo = archive.infolist() assert len(zipinfo) == 1 assert zipinfo[0].filename == 'xl/media/image1.png'