aboutsummaryrefslogtreecommitdiff
path: root/tests/docx/relationships_xml_tests.py
blob: f2280d9db188394e2162179ca912e5f43f141480 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from nose.tools import istest, assert_equal

from mammoth.docx.xmlparser import element as xml_element
from mammoth.docx.relationships_xml import \
    read_relationships_xml_element, Relationship


@istest
def target_is_read_from_relationship_element():
    element = xml_element("relationships:Relationships", {}, [
        xml_element("relationships:Relationship", {
            "Id": "rId8",
            "Type": "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
            "Target": "http://example.com",
        })
    ])
    relationships = read_relationships_xml_element(element)
    assert_equal(
        Relationship(target="http://example.com"),
        relationships["rId8"],
    )