From 828bc9766ff8e734fbb85c3cff5b0d98d3487b54 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Mon, 3 Apr 2017 11:29:54 +0100 Subject: Add separate transforms module with paragraph() --- tests/mammoth_tests.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests') 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 @@ -305,6 +305,17 @@ def transform_document_is_applied_to_document_before_conversion(): assert_equal([], result.messages) +@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("

Walking on imported air

", 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: -- cgit v1.2.3