/usr/lib/python3/dist-packages/openpyxl/writer/tests/test_image.py is in python3-openpyxl 2.3.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
# stdlib imports
from io import BytesIO
from weakref import ref
import zipfile
import pytest
# package imports
from openpyxl.workbook import Workbook
from openpyxl.writer.excel import ExcelWriter
@pytest.mark.pil_required
def test_write_images(datadir):
datadir.chdir()
wb = Workbook()
ew = ExcelWriter(workbook=wb)
from openpyxl.drawing.image import Image
img = Image("plain.png")
wb._images.append(ref(img))
buf = BytesIO()
archive = zipfile.ZipFile(buf, 'w')
ew._write_images(archive)
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'
|