From 2c9955f0590d93968b4959e3622d01610e398700 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 15 Aug 2015 18:11:46 +0100 Subject: Continue with warning style mapping cannot be parsed --- tests/mammoth_tests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/mammoth_tests.py') diff --git a/tests/mammoth_tests.py b/tests/mammoth_tests.py index 88aa445..ddcb9a6 100644 --- a/tests/mammoth_tests.py +++ b/tests/mammoth_tests.py @@ -7,6 +7,7 @@ from nose.tools import istest, assert_equal from .testing import test_path import mammoth +from mammoth import results @istest @@ -40,6 +41,17 @@ def empty_paragraphs_are_preserved_if_ignore_empty_paragraphs_is_false(): assert_equal("

", result.value) assert_equal([], result.messages) +@istest +def warning_if_style_mapping_is_not_understood(): + style_map = """ +!!!! +p => h1""" + with open(test_path("single-paragraph.docx"), "rb") as fileobj: + result = mammoth.convert_to_html(fileobj=fileobj, style_map=style_map) + assert_equal("

Walking on imported air

", result.value) + warning = "Did not understand this style mapping, so ignored it: !!!!" + assert_equal([results.warning(warning)], result.messages) + @istest def inline_images_are_included_in_output(): -- cgit v1.2.3