From dd44939b3ec3c59a3c8a89e8d5d4128642bb7b59 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 14 Dec 2013 17:49:58 +0000 Subject: Handle image encoding properly --- tests/conversion_tests.py | 6 +++--- tests/mammoth_tests.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/conversion_tests.py b/tests/conversion_tests.py index d9742cc..cb9b064 100644 --- a/tests/conversion_tests.py +++ b/tests/conversion_tests.py @@ -145,14 +145,14 @@ def docx_tab_is_converted_to_tab_in_html(): @istest def images_are_converted_to_img_tags_with_data_uri(): - image = documents.image(alt_text=None, content_type="image/png", open=lambda: io.BytesIO("abc")) + image = documents.image(alt_text=None, content_type="image/png", open=lambda: io.BytesIO(b"abc")) result = convert_document_element_to_html(image) assert_equal('', result.value) @istest def images_have_alt_tags_if_available(): - image = documents.image(alt_text="It's a hat", content_type="image/png", open=lambda: io.BytesIO("abc")) + image = documents.image(alt_text="It's a hat", content_type="image/png", open=lambda: io.BytesIO(b"abc")) result = convert_document_element_to_html(image) assert_equal('It\'s a hat', result.value) @@ -163,7 +163,7 @@ def can_define_custom_conversion_for_images(): with image.open() as image_file: html_generator.self_closing("img", {"alt": image_file.read()}) - image = documents.image(alt_text=None, content_type="image/png", open=lambda: io.BytesIO("abc")) + image = documents.image(alt_text=None, content_type="image/png", open=lambda: io.BytesIO(b"abc")) result = convert_document_element_to_html(image, convert_image=convert_image) assert_equal('abc', result.value) diff --git a/tests/mammoth_tests.py b/tests/mammoth_tests.py index bfa88b5..f2469a9 100644 --- a/tests/mammoth_tests.py +++ b/tests/mammoth_tests.py @@ -17,7 +17,7 @@ def docx_containing_one_paragraph_is_converted_to_single_p_element(): def inline_images_are_included_in_output(): with open(test_path("tiny-picture.docx"), "rb") as fileobj: result = mammoth.convert_to_html(fileobj=fileobj) - assert_equal("""

""", result.value) + assert_equal("""

""", result.value) assert_equal([], result.messages) -- cgit v1.2.3