diff options
| author | Michael Williamson <mike@zwobble.org> | 2015-07-15 16:19:22 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2015-07-15 16:19:22 +0100 |
| commit | d18e908606feeb30b21adf9a583065e6a5a74a0f (patch) | |
| tree | a6d2178250f8b5597669ba39ac3c93cf42223820 | |
| parent | cca52c7e31190882e385941b635538af3f9a5c0e (diff) | |
Specify blip rather than relationship in image tests
| -rw-r--r-- | tests/docx/body_xml_tests.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/tests/docx/body_xml_tests.py b/tests/docx/body_xml_tests.py index 1f7e10c..91be80f 100644 --- a/tests/docx/body_xml_tests.py +++ b/tests/docx/body_xml_tests.py @@ -274,7 +274,7 @@ class ReadXmlElementTests(object): @funk.with_context def can_read_inline_pictures(self, context): drawing_element = _create_inline_image( - relationship_id="rId5", + blip=_embedded_blip("rId5"), description="It's a hat", ) @@ -306,7 +306,7 @@ class ReadXmlElementTests(object): @funk.with_context def can_read_anchored_pictures(self, context): drawing_element = _create_anchored_image( - relationship_id="rId5", + blip=_embedded_blip("rId5"), description="It's a hat", ) @@ -339,7 +339,7 @@ class ReadXmlElementTests(object): @funk.with_context def warning_if_unsupported_image_type(self, context): drawing_element = _create_inline_image( - relationship_id="rId5", + blip=_embedded_blip("rId5"), description="It's a hat", ) @@ -467,28 +467,31 @@ def _text_element(value): return xml_element("w:t", {}, [xml_text(value)]) -def _create_inline_image(description, relationship_id): +def _create_inline_image(description, blip): return xml_element("w:drawing", {}, [ - xml_element("wp:inline", {}, _create_image_elements(description, relationship_id)) + xml_element("wp:inline", {}, _create_image_elements(description, blip)) ]) -def _create_anchored_image(description, relationship_id): +def _create_anchored_image(description, blip): return xml_element("w:drawing", {}, [ - xml_element("wp:anchor", {}, _create_image_elements(description, relationship_id)) + xml_element("wp:anchor", {}, _create_image_elements(description, blip)) ]) -def _create_image_elements(description, relationship_id): +def _create_image_elements(description, blip): return [ xml_element("wp:docPr", {"descr": description}), xml_element("a:graphic", {}, [ xml_element("a:graphicData", {}, [ xml_element("pic:pic", {}, [ xml_element("pic:blipFill", {}, [ - xml_element("a:blip", {"r:embed": relationship_id}) + blip ]) ]) ]) ]) ] + +def _embedded_blip(relationship_id): + return xml_element("a:blip", {"r:embed": relationship_id}) |
