diff options
| author | Michael Williamson <mike@zwobble.org> | 2015-05-17 16:32:49 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2015-05-17 16:32:49 +0100 |
| commit | 74c9f604aa9118ef3693a00714baa4e3f24e21d5 (patch) | |
| tree | c6471590ad62211932bab38e86618b253570f3c3 /tests | |
| parent | d24a8455550fe959e0c2941a917eb1593c191d46 (diff) | |
Add ignore_empty_paragraphs option
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/mammoth_tests.py | 16 | ||||
| -rw-r--r-- | tests/test-data/empty.docx | bin | 0 -> 3306 bytes |
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/mammoth_tests.py b/tests/mammoth_tests.py index ce76221..d9f1093 100644 --- a/tests/mammoth_tests.py +++ b/tests/mammoth_tests.py @@ -26,6 +26,22 @@ def can_read_xml_files_with_utf8_bom(): @istest +def empty_paragraphs_are_ignored_by_default(): + with open(test_path("empty.docx"), "rb") as fileobj: + result = mammoth.convert_to_html(fileobj=fileobj) + assert_equal("", result.value) + assert_equal([], result.messages) + + +@istest +def empty_paragraphs_are_preserved_if_ignore_empty_paragraphs_is_false(): + with open(test_path("empty.docx"), "rb") as fileobj: + result = mammoth.convert_to_html(fileobj=fileobj, ignore_empty_paragraphs=False) + assert_equal("<p></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) diff --git a/tests/test-data/empty.docx b/tests/test-data/empty.docx Binary files differnew file mode 100644 index 0000000..e10b869 --- /dev/null +++ b/tests/test-data/empty.docx |
