/usr/lib/python2.7/dist-packages/openpyxl/drawing/tests/test_line.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 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 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
import pytest
from openpyxl.xml.functions import fromstring, tostring
from openpyxl.tests.helper import compare_xml
@pytest.fixture
def LineProperties():
from ..line import LineProperties
return LineProperties
class TestLineProperties:
def test_ctor(self, LineProperties):
line = LineProperties(w=10)
xml = tostring(line.to_tree())
expected = """
<ln w="10" xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
<prstDash val="solid" />
</ln>
"""
diff = compare_xml(xml, expected)
assert diff is None, diff
def test_color(self, LineProperties):
line = LineProperties(w=10)
line.solidFill = "FF0000"
xml = tostring(line.to_tree())
expected = """
<ln w="10" xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
<solidFill>
<srgbClr val="FF0000" />
</solidFill>
<prstDash val="solid" />
</ln>
"""
diff = compare_xml(xml, expected)
assert diff is None, diff
def test_from_xml(self, LineProperties):
src = """
<ln w="38100" cmpd="sng">
<prstDash val="solid"/>
</ln>
"""
node = fromstring(src)
line = LineProperties.from_tree(node)
assert line == LineProperties(w=38100, cmpd="sng")
@pytest.fixture
def LineEndProperties():
from ..line import LineEndProperties
return LineEndProperties
class TestLineEndProperties:
def test_ctor(self, LineEndProperties):
line = LineEndProperties()
xml = tostring(line.to_tree())
expected = """
<end xmlns="http://schemas.openxmlformats.org/drawingml/2006/main" />
"""
diff = compare_xml(xml, expected)
assert diff is None, diff
def test_from_xml(self, LineEndProperties):
src = """
<end />
"""
node = fromstring(src)
line = LineEndProperties.from_tree(node)
assert line == LineEndProperties()
@pytest.fixture
def DashStop():
from ..line import DashStop
return DashStop
class TestDashStop:
def test_ctor(self, DashStop):
line = DashStop()
xml = tostring(line.to_tree())
expected = """
<ds xmlns="http://schemas.openxmlformats.org/drawingml/2006/main" d="0" sp="0"></ds>
"""
diff = compare_xml(xml, expected)
assert diff is None, diff
def test_from_xml(self, DashStop):
src = """
<ds d="10" sp="15"></ds>
"""
node = fromstring(src)
line = DashStop.from_tree(node)
assert line == DashStop(d=10, sp=15)
@pytest.fixture
def LineJoinMiterProperties():
from ..line import LineJoinMiterProperties
return LineJoinMiterProperties
class TestLineJoinMiterProperties:
def test_ctor(self, LineJoinMiterProperties):
line = LineJoinMiterProperties()
xml = tostring(line.to_tree())
expected = """
<miter xmlns="http://schemas.openxmlformats.org/drawingml/2006/main" />
"""
diff = compare_xml(xml, expected)
assert diff is None, diff
def test_from_xml(self, LineJoinMiterProperties):
src = """
<miter />
"""
node = fromstring(src)
line = LineJoinMiterProperties.from_tree(node)
assert line == LineJoinMiterProperties()
|