This file is indexed.

/usr/lib/python2.7/dist-packages/openpyxl/xml/tests/test_functions.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
71
72
73
74
75
76
import pytest

from openpyxl.xml.functions import ConditionalElement

import xml

@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


@pytest.mark.lxml_required
def test_dont_resolve():
    from ..functions import fromstring
    s = b"""<?xml version="1.0" encoding="ISO-8859-1"?>
            <!DOCTYPE foo [
            <!ELEMENT foo ANY >
            <!ENTITY xxe SYSTEM "file:///dev/random" >]>
            <foo>&xxe;</foo>"""
    node = fromstring(s)


@pytest.mark.no_lxml
def test_dont_resolve():
    from ..functions import fromstring
    s = b"""<?xml version="1.0" encoding="ISO-8859-1"?>
            <!DOCTYPE foo [
            <!ELEMENT foo ANY >
            <!ENTITY xxe SYSTEM "file:///dev/random" >]>
            <foo>&xxe;</foo>"""
    with pytest.raises(xml.etree.ElementTree.ParseError):
        node = fromstring(s)