From 28d664823a7a1fa58825e6488b9c88c2f6d3cb04 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 19 Aug 2014 10:23:40 +0100 Subject: Add test for files with UTF8 BOM --- tests/mammoth_tests.py | 8 ++++++++ tests/test-data/utf8-bom.docx | Bin 0 -> 2836 bytes 2 files changed, 8 insertions(+) create mode 100644 tests/test-data/utf8-bom.docx diff --git a/tests/mammoth_tests.py b/tests/mammoth_tests.py index 9721d15..7ef8049 100644 --- a/tests/mammoth_tests.py +++ b/tests/mammoth_tests.py @@ -13,6 +13,14 @@ def docx_containing_one_paragraph_is_converted_to_single_p_element(): assert_equal([], result.messages) +@istest +def can_read_xml_files_with_utf8_bom(): + with open(test_path("utf8-bom.docx"), "rb") as fileobj: + result = mammoth.convert_to_html(fileobj=fileobj) + assert_equal("

This XML has a byte order mark.

", result.value) + assert_equal([], result.messages) + + @istest def inline_images_are_included_in_output(): with open(test_path("tiny-picture.docx"), "rb") as fileobj: diff --git a/tests/test-data/utf8-bom.docx b/tests/test-data/utf8-bom.docx new file mode 100644 index 0000000..3881238 Binary files /dev/null and b/tests/test-data/utf8-bom.docx differ -- cgit v1.2.3