/usr/lib/python2.7/dist-packages/openpyxl/drawing/tests/test_fill.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 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | 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 PatternFillProperties():
from ..fill import PatternFillProperties
return PatternFillProperties
class TestPatternFillProperties:
def test_ctor(self, PatternFillProperties):
fill = PatternFillProperties(prst="cross",)
xml = tostring(fill.to_tree())
expected = """
<pattFill prst="cross"></pattFill>
"""
diff = compare_xml(xml, expected)
assert diff is None, diff
def test_from_xml(self, PatternFillProperties):
src = """
<pattFill prst="dashHorz" />
"""
node = fromstring(src)
fill = PatternFillProperties.from_tree(node)
assert fill == PatternFillProperties("dashHorz")
@pytest.fixture
def RelativeRect():
from ..fill import RelativeRect
return RelativeRect
class TestRelativeRect:
def test_ctor(self, RelativeRect):
fill = RelativeRect(10, 15, 20, 25)
xml = tostring(fill.to_tree())
expected = """
<rect xmlns="http://schemas.openxmlformats.org/drawingml/2006/main" b="25" l="10" r="20" t="15" />
"""
diff = compare_xml(xml, expected)
assert diff is None, diff
def test_from_xml(self, RelativeRect):
src = """
<rect b="25" l="10" r="20" t="15" />
"""
node = fromstring(src)
fill = RelativeRect.from_tree(node)
assert fill == RelativeRect(10, 15, 20, 25)
@pytest.fixture
def StretchInfoProperties():
from ..fill import StretchInfoProperties
return StretchInfoProperties
class TestStretchInfoProperties:
def test_ctor(self, StretchInfoProperties):
fill = StretchInfoProperties()
xml = tostring(fill.to_tree())
expected = """
<stretch xmlns="http://schemas.openxmlformats.org/drawingml/2006/main" />
"""
diff = compare_xml(xml, expected)
assert diff is None, diff
def test_from_xml(self, StretchInfoProperties):
src = """
<stretch />
"""
node = fromstring(src)
fill = StretchInfoProperties.from_tree(node)
assert fill == StretchInfoProperties()
@pytest.fixture
def GradientStop():
from ..fill import GradientStop
return GradientStop
class TestGradientStop:
def test_ctor(self, GradientStop):
fill = GradientStop()
xml = tostring(fill.to_tree())
expected = """
<gradStop />
"""
diff = compare_xml(xml, expected)
assert diff is None, diff
def test_from_xml(self, GradientStop):
src = """
<gradStop />
"""
node = fromstring(src)
fill = GradientStop.from_tree(node)
assert fill == GradientStop()
@pytest.fixture
def GradientStopList():
from ..fill import GradientStopList
return GradientStopList
class TestGradientStopList:
def test_ctor(self, GradientStopList):
fill = GradientStopList()
xml = tostring(fill.to_tree())
expected = """
<gradStopLst>
<gs />
<gs />
</gradStopLst>
"""
diff = compare_xml(xml, expected)
assert diff is None, diff
def test_from_xml(self, GradientStopList):
src = """
<gradStopLst>
<gs />
<gs />
</gradStopLst>
"""
node = fromstring(src)
fill = GradientStopList.from_tree(node)
assert fill == GradientStopList()
@pytest.fixture
def GradientFillProperties():
from ..fill import GradientFillProperties
return GradientFillProperties
class TestGradientFillProperties:
def test_ctor(self, GradientFillProperties):
fill = GradientFillProperties(flip="xy")
xml = tostring(fill.to_tree())
expected = """
<gradFill flip="xy" />
"""
diff = compare_xml(xml, expected)
assert diff is None, diff
def test_from_xml(self, GradientFillProperties):
src = """
<root />
"""
node = fromstring(src)
fill = GradientFillProperties.from_tree(node)
assert fill == GradientFillProperties()
@pytest.fixture
def Blip():
from ..fill import Blip
return Blip
class TestBlip:
def test_ctor(self, Blip):
fill = Blip(embed="rId1")
xml = tostring(fill.to_tree())
expected = """
<blip xmlns="http://schemas.openxmlformats.org/drawingml/2006/main"
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:embed="rId1" />
"""
diff = compare_xml(xml, expected)
assert diff is None, diff
def test_from_xml(self, Blip):
src = """
<blip />
"""
node = fromstring(src)
fill = Blip.from_tree(node)
assert fill == Blip()
@pytest.fixture
def BlipFillProperties():
from ..fill import BlipFillProperties
return BlipFillProperties
class TestBlipFillProperties:
def test_ctor(self, BlipFillProperties):
fill = BlipFillProperties()
xml = tostring(fill.to_tree())
expected = """
<blipFill />
"""
diff = compare_xml(xml, expected)
assert diff is None, diff
def test_from_xml(self, BlipFillProperties):
src = """
<blipFill />
"""
node = fromstring(src)
fill = BlipFillProperties.from_tree(node)
assert fill == BlipFillProperties()
|