aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-07-03 15:26:15 +0100
committerMichael Williamson <mike@zwobble.org>2016-07-03 15:26:15 +0100
commitb249ef56971405e7b1d0b4bb3b9cfb4e779583ab (patch)
tree26d26bed8596a52613ee90a2ac1f745e86ef6a64 /tests
parent63974a9b4d026eed3b7a8b8c0ef2278ff28c4d18 (diff)
Wire up code for converting comments
Diffstat (limited to 'tests')
-rw-r--r--tests/mammoth_tests.py16
-rwxr-xr-xtests/test-data/comments.docxbin0 -> 15526 bytes
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/mammoth_tests.py b/tests/mammoth_tests.py
index 201df70..8ad9b33 100644
--- a/tests/mammoth_tests.py
+++ b/tests/mammoth_tests.py
@@ -185,6 +185,22 @@ def relationships_are_handled_properly_in_footnotes():
@istest
+def when_style_mapping_is_defined_for_comment_references_then_comments_are_included():
+ expected_html = (
+ '<p>Ouch' +
+ '<sup><a href="#doc-42-comment-0" id="doc-42-comment-ref-0">[MW 1]</a></sup>.' +
+ '<sup><a href="#doc-42-comment-2" id="doc-42-comment-ref-2">[MW 2]</a></sup></p>' +
+ '<dl><dt id="doc-42-comment-0">MW 1</dt><dd><p>A tachyon walks into a bar. <a href="#doc-42-comment-ref-0">↑</a></p></dd>' +
+ '<dt id="doc-42-comment-2">MW 2</dt><dd><p>Fin. <a href="#doc-42-comment-ref-2">↑</a></p></dd></dl>'
+ )
+
+ with open(test_path("comments.docx"), "rb") as fileobj:
+ result = mammoth.convert_to_html(fileobj=fileobj, id_prefix="doc-42-", style_map="comment-reference => sup")
+ assert_equal([], result.messages)
+ assert_equal(expected_html, result.value)
+
+
+@istest
def text_boxes_are_read():
with open(test_path("text-box.docx"), "rb") as fileobj:
result = mammoth.convert_to_html(fileobj=fileobj)
diff --git a/tests/test-data/comments.docx b/tests/test-data/comments.docx
new file mode 100755
index 0000000..32cdae1
--- /dev/null
+++ b/tests/test-data/comments.docx
Binary files differ