diff options
| author | Michael Williamson <mike@zwobble.org> | 2017-04-03 11:29:54 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2017-04-03 11:29:54 +0100 |
| commit | 828bc9766ff8e734fbb85c3cff5b0d98d3487b54 (patch) | |
| tree | 5e797dee488e02a4702ec506734ebd6e671be8cf /tests/mammoth_tests.py | |
| parent | 4085795d9b8f1845aff4a4b2eb7e5bc377302bcd (diff) | |
Add separate transforms module with paragraph()
Diffstat (limited to 'tests/mammoth_tests.py')
| -rw-r--r-- | tests/mammoth_tests.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/mammoth_tests.py b/tests/mammoth_tests.py index bcdf5a8..1dcbaa9 100644 --- a/tests/mammoth_tests.py +++ b/tests/mammoth_tests.py @@ -306,6 +306,17 @@ def transform_document_is_applied_to_document_before_conversion(): @istest +def paragraph_transform_only_transforms_paragraphs(): + def transform_paragraph(paragraph): + return paragraph.copy(style_id="Heading1") + transform_document = mammoth.transforms.paragraph(transform_paragraph) + 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) + + +@istest def docx_containing_one_paragraph_can_be_converted_to_markdown(): with open(test_path("single-paragraph.docx"), "rb") as fileobj: result = mammoth.convert_to_markdown(fileobj=fileobj) |
