/usr/lib/python2.7/dist-packages/openpyxl/worksheet/tests/test_properties.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 | from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
import pytest
from openpyxl.xml.functions import tostring, fromstring
from openpyxl.tests.helper import compare_xml
def test_ctor():
from .. properties import WorksheetProperties, Outline
color_test = 'F0F0F0'
outline_pr = Outline(summaryBelow=True, summaryRight=True)
wsprops = WorksheetProperties(tabColor=color_test, outlinePr=outline_pr)
assert dict(wsprops) == {}
assert dict(wsprops.outlinePr) == {'summaryBelow': '1', 'summaryRight': '1'}
assert dict(wsprops.tabColor) == {'rgb': '00F0F0F0'}
@pytest.fixture
def SimpleTestProps():
from .. properties import WorksheetProperties
wsp = WorksheetProperties()
wsp.filterMode = False
wsp.tabColor = 'FF123456'
wsp.pageSetUpPr.fitToPage = False
return wsp
def test_write_properties(SimpleTestProps):
xml = tostring(SimpleTestProps.to_tree())
expected = """
<sheetPr filterMode="0">
<tabColor rgb="FF123456"/>
<outlinePr summaryBelow="1" summaryRight="1"></outlinePr>
<pageSetUpPr fitToPage="0" />
</sheetPr>"""
diff = compare_xml(xml, expected)
assert diff is None, diff
def test_parse_properties(datadir, SimpleTestProps):
from .. properties import WorksheetProperties
datadir.chdir()
with open("sheetPr2.xml") as src:
content = src.read()
xml = fromstring(content)
parseditem = WorksheetProperties.from_tree(xml)
assert dict(parseditem) == dict(SimpleTestProps)
assert parseditem.tabColor == SimpleTestProps.tabColor
assert dict(parseditem.pageSetUpPr) == dict(SimpleTestProps.pageSetUpPr)
|