From 74c9f604aa9118ef3693a00714baa4e3f24e21d5 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 17 May 2015 16:32:49 +0100 Subject: Add ignore_empty_paragraphs option --- tests/mammoth_tests.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/mammoth_tests.py') 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 @@ -25,6 +25,22 @@ def can_read_xml_files_with_utf8_bom(): assert_equal([], result.messages) +@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("

", result.value) + assert_equal([], result.messages) + + @istest def inline_images_are_included_in_output(): with open(test_path("tiny-picture.docx"), "rb") as fileobj: -- cgit v1.2.3