aboutsummaryrefslogtreecommitdiff
path: root/tests/docx
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2021-11-01 19:18:15 +0000
committerMichael Williamson <mike@zwobble.org>2021-11-01 19:19:41 +0000
commit6dee8fcbc822e4fcad128add2637c5955c694a7f (patch)
tree5683d137efda5f615ba07be03092ce4a8804d112 /tests/docx
parenta33648f65f11d3818477915bea212a274a6981df (diff)
Add tests for when image cannot be found
Diffstat (limited to 'tests/docx')
-rw-r--r--tests/docx/body_xml_tests.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/docx/body_xml_tests.py b/tests/docx/body_xml_tests.py
index 0429805..1ce2e95 100644
--- a/tests/docx/body_xml_tests.py
+++ b/tests/docx/body_xml_tests.py
@@ -1182,6 +1182,24 @@ class ImageTests(object):
expected_warning = results.warning("Image of type image/x-emf is unlikely to display in web browsers")
assert_equal([expected_warning], result.messages)
+ @istest
+ def no_elements_created_if_image_cannot_be_found_in_w_drawing(self):
+ drawing = xml_element("w:drawing")
+
+ result = _read_document_xml_element(drawing)
+
+ assert_equal([], result.messages)
+ assert_equal(None, result.value)
+
+ @istest
+ def no_elements_created_if_image_cannot_be_found_in_wp_inline(self):
+ drawing = xml_element("wp:inline")
+
+ result = _read_document_xml_element(drawing)
+
+ assert_equal([], result.messages)
+ assert_equal(None, result.value)
+
@istest
def footnote_reference_has_id_read():