/usr/lib/python2.7/dist-packages/openpyxl/styles/tests/test_styleable.py is in python-openpyxl 2.3.0-3.
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 | from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
import pytest
from openpyxl.utils.indexed_list import IndexedList
from ..import Style, Font, Border, PatternFill, Alignment, Protection
def test_descriptor():
from ..styleable import StyleDescriptor, StyleArray
from ..fonts import Font
class Styled(object):
font = StyleDescriptor('_fonts', "fontId")
def __init__(self):
self._style = StyleArray()
self.parent = DummyWorksheet()
styled = Styled()
styled.font = Font()
assert styled.font == Font()
class DummyWorkbook:
_fonts = IndexedList()
_fills = IndexedList()
_borders = IndexedList()
_protections = IndexedList()
_alignments = IndexedList()
_number_formats = IndexedList()
class DummyWorksheet:
parent = DummyWorkbook()
@pytest.fixture
def StyleableObject():
from .. styleable import StyleableObject
return StyleableObject
def test_has_style(StyleableObject):
so = StyleableObject(sheet=DummyWorksheet())
assert not so.has_style
so.number_format= 'dd'
assert so.has_style
def test_style(StyleableObject):
so = StyleableObject(sheet=DummyWorksheet())
so.font = Font(bold=True)
so.fill = PatternFill()
so.border = Border()
so.protection = Protection()
so.alignment = Alignment()
so.number_format = "not general"
assert so.style == Style(font=Font(bold=True), number_format="not general")
def test_assign_style(StyleableObject):
so = StyleableObject(sheet=DummyWorksheet())
style = Style(font=Font(underline="single"))
so.style = style
assert style.font == Font(underline="single")
|