aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/conversion_tests.py2
-rw-r--r--tests/mammoth_tests.py17
-rw-r--r--tests/style_reader_tests.py4
3 files changed, 20 insertions, 3 deletions
diff --git a/tests/conversion_tests.py b/tests/conversion_tests.py
index c0fab30..d9742cc 100644
--- a/tests/conversion_tests.py
+++ b/tests/conversion_tests.py
@@ -81,7 +81,7 @@ def bulleted_paragraphs_are_converted_using_matching_styles():
result = convert_document_element_to_html(
documents.paragraph(children=[
_run_with_text("Hello")
- ], numbering=documents.numbering_level(level_index=1, is_ordered=False)),
+ ], numbering=documents.numbering_level(level_index=0, is_ordered=False)),
styles=[
style_reader.read_style("p:unordered-list(1) => ul > li:fresh")
]
diff --git a/tests/mammoth_tests.py b/tests/mammoth_tests.py
index d1492b3..bfa88b5 100644
--- a/tests/mammoth_tests.py
+++ b/tests/mammoth_tests.py
@@ -11,3 +11,20 @@ def docx_containing_one_paragraph_is_converted_to_single_p_element():
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,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAO\nvgAADr4B6kKxwAAAABNJREFUKFNj/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)
+
diff --git a/tests/style_reader_tests.py b/tests/style_reader_tests.py
index 0d266d6..32636db 100644
--- a/tests/style_reader_tests.py
+++ b/tests/style_reader_tests.py
@@ -82,7 +82,7 @@ class ReadDocumentMatcherTests(object):
@istest
def reads_paragraph_ordered_list(self):
assert_equal(
- document_matchers.paragraph(numbering=documents.numbering_level(2, is_ordered=True)),
+ document_matchers.paragraph(numbering=documents.numbering_level(1, is_ordered=True)),
read_document_matcher("p:ordered-list(2)")
)
@@ -90,7 +90,7 @@ class ReadDocumentMatcherTests(object):
@istest
def reads_paragraph_unordered_list(self):
assert_equal(
- document_matchers.paragraph(numbering=documents.numbering_level(2, is_ordered=False)),
+ document_matchers.paragraph(numbering=documents.numbering_level(1, is_ordered=False)),
read_document_matcher("p:unordered-list(2)")
)