/usr/lib/python3/dist-packages/openpyxl/packaging/tests/test_relationship.py is in python3-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 | from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
import pytest
from openpyxl.tests.helper import compare_xml
from openpyxl.xml.functions import tostring
@pytest.fixture
def Relationship():
from ..relationship import Relationship
return Relationship
def test_ctor(Relationship):
rel = Relationship("drawing", "drawings.xml", "external", "4")
assert dict(rel) == {'Id': '4', 'Target': 'drawings.xml', 'TargetMode':
'external', 'Type':
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing'}
expected = """<Relationship Id="4" Target="drawings.xml" TargetMode="external" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing" />
"""
xml = tostring(rel.to_tree())
diff = compare_xml(xml, expected)
assert diff is None, diff
def test_sequence(Relationship):
from ..relationship import RelationshipList
rels = RelationshipList()
rels.append(Relationship("drawing", "drawings.xml", "external", ""))
rels.append(Relationship("chart", "chart1.xml", "", "chart"))
xml = tostring(rels.to_tree())
expected = """
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId1" Target="drawings.xml" TargetMode="external" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing"/>
<Relationship Id="chart" Target="chart1.xml" TargetMode="" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"/>
</Relationships>
"""
diff = compare_xml(xml, expected)
assert diff is None, diff
|