/usr/lib/python2.7/dist-packages/openpyxl/xml/tests/test_functions.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 | import pytest
from openpyxl.xml.functions import ConditionalElement
@pytest.fixture
def root():
from openpyxl.xml.functions import Element
return Element("root")
@pytest.mark.parametrize("condition", [True, 1, -1])
def test_simple(root, condition):
ConditionalElement(root, "start", condition)
assert root.find("start").tag == "start"
def test_simple_attrib(root):
ConditionalElement(root, "start", True, 'val')
tag = root.find("start")
assert tag.attrib == {'val': '1'}
def test_dict_attrib(root):
ConditionalElement(root, "start", True, {'val':'single'})
tag = root.find("start")
assert tag.attrib == {'val':'single'}
@pytest.mark.parametrize("condition", [False, 0, None])
def test_no_tag(root, condition):
ConditionalElement(root, "start", condition)
assert root.find("start") is None
def test_safe_iterator_none():
from .. functions import safe_iterator
seq = safe_iterator(None)
assert seq == []
@pytest.mark.parametrize("xml, tag",
[
("<root xmlns='http://openpyxl.org/ns' />", "root"),
("<root />", "root"),
]
)
def test_localtag(xml, tag):
from .. functions import localname
from .. functions import fromstring
node = fromstring(xml)
assert localname(node) == tag
|