blob: f2469a9ca861958b7c5975ce126007adee3b35eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
from nose.tools import istest, assert_equal
from .testing import test_path
import mammoth
@istest
def docx_containing_one_paragraph_is_converted_to_single_p_element():
with open(test_path("single-paragraph.docx"), "rb") as fileobj:
result = mammoth.convert_to_html(fileobj=fileobj)
assert_equal("<p>Walking on imported air</p>", result.value)
assert_equal([], result.messages)
@istest
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("""<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAOvgAADr4B6kKxwAAAABNJREFUKFNj/M+ADzDhlWUYqdIAQSwBE8U+X40AAAAASUVORK5CYII=" /></p>""", result.value)
assert_equal([], result.messages)
@istest
def simple_list_is_converted_to_list_elements():
with open(test_path("simple-list.docx"), "rb") as fileobj:
result = mammoth.convert_to_html(fileobj=fileobj)
assert_equal([], result.messages)
assert_equal("<ul><li>Apple</li><li>Banana</li></ul>", result.value)
|