From 78d5cca66ca8f204d5db1aff81519c142705add9 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 8 Jan 2014 18:01:44 +0000 Subject: Add transform_document argument to convert_to_html --- tests/mammoth_tests.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/mammoth_tests.py b/tests/mammoth_tests.py index f2469a9..77e7ec2 100644 --- a/tests/mammoth_tests.py +++ b/tests/mammoth_tests.py @@ -27,4 +27,15 @@ def simple_list_is_converted_to_list_elements(): result = mammoth.convert_to_html(fileobj=fileobj) assert_equal([], result.messages) assert_equal("", result.value) - + + +@istest +def transform_document_is_applied_to_document_before_conversion(): + def transform_document(document): + document.children[0].style_name = "Heading1" + return document + + with open(test_path("single-paragraph.docx"), "rb") as fileobj: + result = mammoth.convert_to_html(fileobj=fileobj, transform_document=transform_document) + assert_equal("

Walking on imported air

", result.value) + assert_equal([], result.messages) -- cgit v1.2.3