From a2efd2e2a4437b4e05d6842e2510d96fb144f240 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 13 Nov 2016 12:16:10 +0000 Subject: Add test for pre-created style map --- tests/mammoth_tests.py | 8 ++++++++ tests/test-data/embedded-style-map.docx | Bin 0 -> 49709 bytes 2 files changed, 8 insertions(+) create mode 100644 tests/test-data/embedded-style-map.docx (limited to 'tests') diff --git a/tests/mammoth_tests.py b/tests/mammoth_tests.py index 4390544..1f638ec 100644 --- a/tests/mammoth_tests.py +++ b/tests/mammoth_tests.py @@ -49,6 +49,14 @@ def empty_paragraphs_are_preserved_if_ignore_empty_paragraphs_is_false(): @istest def embedded_style_map_is_used_if_present(): + with open(test_path("embedded-style-map.docx"), "rb") as fileobj: + result = mammoth.convert_to_html(fileobj=fileobj) + assert_equal("

Walking on imported air

", result.value) + assert_equal([], result.messages) + + +@istest +def embedded_style_map_can_be_written_and_then_read(): with _copy_of_test_data("single-paragraph.docx") as fileobj: mammoth.embed_style_map(fileobj, "p => h1") result = mammoth.convert_to_html(fileobj=fileobj, ignore_empty_paragraphs=False) diff --git a/tests/test-data/embedded-style-map.docx b/tests/test-data/embedded-style-map.docx new file mode 100644 index 0000000..bb0a5e2 Binary files /dev/null and b/tests/test-data/embedded-style-map.docx differ -- cgit v1.2.3