/usr/lib/python3/dist-packages/openpyxl/styles/tests/test_colors.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 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 | from openpyxl.styles.colors import Color
import pytest
@pytest.mark.parametrize("value", ['00FFFFFF', 'efefef'])
def test_argb(value):
from ..colors import aRGB_REGEX
assert aRGB_REGEX.match(value) is not None
class TestColor:
def test_ctor(self):
c = Color()
assert c.value == "00000000"
assert c.type == "rgb"
assert dict(c) == {'rgb': '00000000'}
def test_rgb(self):
c = Color(rgb="FFFFFFFF")
assert c.value == "FFFFFFFF"
assert c.type == "rgb"
assert dict(c) == {'rgb': 'FFFFFFFF'}
def test_indexed(self):
c = Color(indexed=4)
assert c.value == 4
assert c.type == "indexed"
assert dict(c) == {'indexed': "4"}
def test_auto(self):
c = Color(auto=1)
assert c.type is "auto"
assert c.value is True
assert dict(c) == {'auto': "1"}
def test_theme(self):
c = Color(theme="1")
assert c.value == 1
assert c.type == "theme"
assert dict(c) == {'theme': "1"}
def test_tint(self):
c = Color(tint=0.5)
assert c.tint == 0.5
assert dict(c) == {'rgb': '00000000', 'tint': "0.5"}
def test_highlander(self):
c = Color(rgb="FFFFFFF", indexed=4, theme=2, auto=False)
assert c.value == 4
assert c.type == "indexed"
def test_validation(self):
c = Color()
with pytest.raises(TypeError):
c.value = 4
def test_color_descriptor():
from ..colors import ColorDescriptor
class DummyStyle(object):
value = ColorDescriptor('value')
style = DummyStyle()
style.value = "efefef"
assert dict(style.value) == {'rgb': '00efefef'}
|