From 6dee8fcbc822e4fcad128add2637c5955c694a7f Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Mon, 1 Nov 2021 19:18:15 +0000 Subject: Add tests for when image cannot be found --- tests/docx/body_xml_tests.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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(): -- cgit v1.2.3