aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/mammoth_tests.py13
1 files changed, 12 insertions, 1 deletions
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("<ul><li>Apple</li><li>Banana</li></ul>", 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("<h1>Walking on imported air</h1>", result.value)
+ assert_equal([], result.messages)