diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-12-14 16:48:59 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-12-14 16:48:59 +0000 |
| commit | 93e945c2ca0b1118c8e119a09988d8b4093625d8 (patch) | |
| tree | b12810548cffc620c4bef09b364c8f6bd43373b5 /tests | |
| parent | 6f9267b715dc2d0e9c722918c074a8cd6a35e2e3 (diff) | |
Convert image using base64 encoding
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/conversion_tests.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/conversion_tests.py b/tests/conversion_tests.py index 7dc8b06..8935bb5 100644 --- a/tests/conversion_tests.py +++ b/tests/conversion_tests.py @@ -1,3 +1,5 @@ +import io + from nose.tools import istest, assert_equal from mammoth import documents, style_reader, results @@ -115,5 +117,12 @@ def docx_tab_is_converted_to_tab_in_html(): assert_equal('\t', result.value) +@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")) + result = convert_document_element_to_html(image) + assert_equal('<img src="data:image/png;base64,YWJj" />', result.value) + + def _run_with_text(text): return documents.run(children=[documents.text(text)]) |
