/usr/lib/python2.7/dist-packages/openpyxl/drawing/tests/test_drawing.py is in python-openpyxl 2.4.9-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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | from __future__ import absolute_import
# Copyright (c) 2010-2017 openpyxl
import pytest
from openpyxl.xml.functions import Element, tostring
from openpyxl.tests.helper import compare_xml
class TestDrawing(object):
def setup(self):
from ..drawing import Drawing
self.drawing = Drawing()
def test_ctor(self):
d = self.drawing
assert d.coordinates == ((1, 2), (16, 8))
assert d.width == 21
assert d.height == 192
assert d.left == 0
assert d.top == 0
assert d.count == 0
assert d.rotation == 0
assert d.resize_proportional is False
assert d.description == ""
assert d.name == ""
def test_width(self):
d = self.drawing
d.width = 100
d.height = 50
assert d.width == 100
def test_proportional_width(self):
d = self.drawing
d.resize_proportional = True
d.width = 100
d.height = 50
assert (d.width, d.height) == (5, 50)
def test_height(self):
d = self.drawing
d.height = 50
d.width = 100
assert d.height == 50
def test_proportional_height(self):
d = self.drawing
d.resize_proportional = True
d.height = 50
d.width = 100
assert (d.width, d.height) == (100, 1000)
def test_set_dimension(self):
d = self.drawing
d.resize_proportional = True
d.set_dimension(100, 50)
assert d.width == 6
assert d.height == 50
d.set_dimension(50, 500)
assert d.width == 50
assert d.height == 417
def test_get_emu(self):
d = self.drawing
dims = d.get_emu_dimensions()
assert dims == (0, 0, 200025, 1828800)
@pytest.mark.pil_required
def test_absolute_anchor(self):
node = self.drawing.anchor
xml = tostring(node.to_tree())
expected = """
<absoluteAnchor>
<pos x="0" y="0"/>
<ext cx="200025" cy="1828800"/>
<clientData></clientData>
</absoluteAnchor>
"""
diff = compare_xml(xml, expected)
assert diff is None, diff
@pytest.mark.pil_required
def test_onecell_anchor(self):
self.drawing.anchortype = "oneCell"
node = self.drawing.anchor
xml = tostring(node.to_tree())
expected = """
<oneCellAnchor>
<from>
<col>0</col>
<colOff>0</colOff>
<row>0</row>
<rowOff>0</rowOff>
</from>
<ext cx="200025" cy="1828800"/>
<clientData></clientData>
</oneCellAnchor>
"""
diff = compare_xml(xml, expected)
assert diff is None, diff
|