aboutsummaryrefslogtreecommitdiff
path: root/tests/docx/document_xml_tests.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-12-01 21:33:53 +0000
committerMichael Williamson <mike@zwobble.org>2013-12-01 21:33:53 +0000
commit8717dd906667c5bf7a6c11f202ab475b14456990 (patch)
tree572c51bb63c80db953445ecbc31d45405020a550 /tests/docx/document_xml_tests.py
parent4fd08468ad3823d09041a0ffa33aba2dd509e192 (diff)
Add support for reading hyperlinks
Diffstat (limited to 'tests/docx/document_xml_tests.py')
-rw-r--r--tests/docx/document_xml_tests.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/docx/document_xml_tests.py b/tests/docx/document_xml_tests.py
index 9badbac..30580d0 100644
--- a/tests/docx/document_xml_tests.py
+++ b/tests/docx/document_xml_tests.py
@@ -130,6 +130,28 @@ class ReadXmlElementTests(object):
)
@istest
+ def hyperlink_is_read_if_it_has_a_relationship_id(self):
+ relationships = Relationships({
+ "r42": Relationship(target="http://example.com")
+ })
+ run_element = xml_element("w:r")
+ element = xml_element("w:hyperlink", {"r:id": "r42"}, [run_element])
+ assert_equal(
+ documents.hyperlink("http://example.com", [documents.run([])]),
+ _read_and_get_document_xml_element(element, relationships=relationships)
+ )
+
+ @istest
+ def hyperlink_is_ignored_if_it_does_not_have_a_relationship_id(self):
+ run_element = xml_element("w:r")
+ element = xml_element("w:hyperlink", {}, [run_element])
+ assert_equal(
+ [documents.run([])],
+ _read_and_get_document_xml_element(element)
+ )
+
+
+ @istest
@funk.with_context
def can_read_inline_pictures(self, context):
drawing_element = _create_inline_image(