diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-01-08 18:01:44 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-01-08 18:01:44 +0000 |
| commit | 78d5cca66ca8f204d5db1aff81519c142705add9 (patch) | |
| tree | 441137c92cecb64833b8ae05800e7799d914eebd /tests | |
| parent | d79153e4cc40ccd13d78cfdc463b55ce6913d221 (diff) | |
Add transform_document argument to convert_to_html
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/mammoth_tests.py | 13 |
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) |
