/usr/lib/python2.7/dist-packages/openpyxl/drawing/tests/test_image.py is in python-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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
import pytest
def test_bounding_box():
from ..image import bounding_box
w, h = bounding_box(80, 80, 90, 100)
assert w == 72
assert h == 80
@pytest.fixture
def Image():
from ..image import Image
return Image
class DummySheet:
"""Required for images"""
def point_pos(self, vertical, horizontal):
return vertical, horizontal
class DummyCell:
"""Required for images"""
column = "A"
row = 1
anchor = (0, 0)
def __init__(self):
self.parent = DummySheet()
class TestImage:
@pytest.mark.pil_not_installed
def test_import(self, Image, datadir):
from ..image import _import_image
datadir.chdir()
with pytest.raises(ImportError):
_import_image("plain.png")
@pytest.mark.pil_required
def test_ctor(self, Image, datadir):
datadir.chdir()
i = Image(img="plain.png")
assert i.nochangearrowheads == True
assert i.nochangeaspect == True
d = i.drawing
assert d.coordinates == ((0, 0), (1, 1))
assert d.width == 118
assert d.height == 118
@pytest.mark.pil_required
def test_anchor(self, Image, datadir):
datadir.chdir()
i = Image("plain.png")
c = DummyCell()
vals = i.anchor(c)
assert vals == (('A', 1), (118, 118))
@pytest.mark.pil_required
def test_anchor_onecell(self, Image, datadir):
datadir.chdir()
i = Image("plain.png")
c = DummyCell()
vals = i.anchor(c, anchortype="oneCell")
assert vals == ((0, 0), None)
|