aboutsummaryrefslogtreecommitdiff
path: root/tests/docx
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-02-11 20:22:54 +0000
committerMichael Williamson <mike@zwobble.org>2015-02-11 20:22:54 +0000
commit7ba9cc0ecdca695fec3cb90c98dd383e0edb2ba9 (patch)
tree560f9225fd1a0c2620fdd143109cb85ee58b721c /tests/docx
parent8d61b083270af4e98ee2411261067a3dd8e48851 (diff)
Read anchor from hyperlinks
Diffstat (limited to 'tests/docx')
-rw-r--r--tests/docx/document_xml_tests.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/docx/document_xml_tests.py b/tests/docx/document_xml_tests.py
index ffa5fbe..12fcef2 100644
--- a/tests/docx/document_xml_tests.py
+++ b/tests/docx/document_xml_tests.py
@@ -218,12 +218,21 @@ class ReadXmlElementTests(object):
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([])]),
+ documents.hyperlink(href="http://example.com", children=[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):
+ def hyperlink_is_read_if_it_has_an_anchor_attribute(self):
+ run_element = xml_element("w:r")
+ element = xml_element("w:hyperlink", {"w:anchor": "start"}, [run_element])
+ assert_equal(
+ documents.hyperlink(anchor="start", children=[documents.run([])]),
+ _read_and_get_document_xml_element(element)
+ )
+
+ @istest
+ def hyperlink_is_ignored_if_it_does_not_have_a_relationship_id_nor_anchor(self):
run_element = xml_element("w:r")
element = xml_element("w:hyperlink", {}, [run_element])
assert_equal(