diff options
| author | Michael Williamson <mike@zwobble.org> | 2015-06-17 14:46:06 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2015-06-17 14:46:06 +0100 |
| commit | 35d3dd58400d5310fe05ebe8e070c96c756edac0 (patch) | |
| tree | dcf0630aad0e48dabfa6a739794a060a6ad4084a | |
| parent | 0c6b13da2020a37b77c97435a7e37d6615ac4211 (diff) | |
Add end-to-end tests for underline handling
| -rw-r--r-- | tests/mammoth_tests.py | 14 | ||||
| -rwxr-xr-x | tests/test-data/underline.docx | bin | 0 -> 12797 bytes |
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/mammoth_tests.py b/tests/mammoth_tests.py index 18f7b48..a1b396c 100644 --- a/tests/mammoth_tests.py +++ b/tests/mammoth_tests.py @@ -110,6 +110,20 @@ def text_boxes_are_read(): @istest +def underline_is_ignored_by_defualt(): + with open(test_path("underline.docx"), "rb") as fileobj: + result = mammoth.convert_to_html(fileobj=fileobj) + assert_equal('<p><strong>The </strong><strong>Sunset</strong><strong> Tree</strong></p>', result.value) + + +@istest +def underline_can_be_configured_with_convert_underline_option(): + with open(test_path("underline.docx"), "rb") as fileobj: + result = mammoth.convert_to_html(fileobj=fileobj, convert_underline=mammoth.underline.element("em")) + assert_equal('<p><strong>The </strong><strong><em>Sunset</em></strong><strong> Tree</strong></p>', result.value) + + +@istest def transform_document_is_applied_to_document_before_conversion(): def transform_document(document): document.children[0].style_id = "Heading1" diff --git a/tests/test-data/underline.docx b/tests/test-data/underline.docx Binary files differnew file mode 100755 index 0000000..36604fc --- /dev/null +++ b/tests/test-data/underline.docx |
