From ba91bed42994af2425540a60b1797d93347e8900 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Mon, 1 Nov 2021 19:34:28 +0000 Subject: Handle a:blip elements without image file --- tests/docx/body_xml_tests.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/docx') diff --git a/tests/docx/body_xml_tests.py b/tests/docx/body_xml_tests.py index 1ce2e95..e0328fb 100644 --- a/tests/docx/body_xml_tests.py +++ b/tests/docx/body_xml_tests.py @@ -1153,6 +1153,17 @@ class ImageTests(object): with image.open() as image_file: assert_equal(self.IMAGE_BYTES, image_file.read()) + @istest + def warning_if_blip_has_no_image_file(self): + drawing = _create_inline_image( + blip=xml_element("a:blip"), + description="It's a hat", + ) + + result = _read_document_xml_element(drawing) + + assert_equal([results.warning("Could not find image file for a:blip element")], result.messages) + assert_equal(None, result.value) @istest @funk.with_mocks -- cgit v1.2.3