summaryrefslogtreecommitdiff
path: root/tests/conversion_tests.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-07-03 15:32:20 +0100
committerMichael Williamson <mike@zwobble.org>2016-07-03 15:32:20 +0100
commit92b00aeb4c1d0ab49507cbd4ad9a25e30a1ac724 (patch)
tree0c77b0fba6fd16bfd74979ebf21532361d3c816c /tests/conversion_tests.py
parentb249ef56971405e7b1d0b4bb3b9cfb4e779583ab (diff)
Handle comments without initials
Diffstat (limited to 'tests/conversion_tests.py')
-rw-r--r--tests/conversion_tests.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/conversion_tests.py b/tests/conversion_tests.py
index 300d1a9..2aec1c1 100644
--- a/tests/conversion_tests.py
+++ b/tests/conversion_tests.py
@@ -7,7 +7,7 @@ import io
from nose.tools import istest, assert_equal
from mammoth import documents, style_reader, results, html
-from mammoth.conversion import convert_document_element_to_html
+from mammoth.conversion import convert_document_element_to_html, _comment_author_label
from mammoth.docx.xmlparser import parse_xml
@@ -475,6 +475,24 @@ def comment_references_are_linked_to_comment_after_main_body():
assert_equal(expected_html, result.value)
+@istest
+def when_initials_are_not_blank_then_comment_author_label_is_initials():
+ assert_equal("TP", _comment_author_label(documents.comment(
+ comment_id="0",
+ body=[],
+ author_initials="TP",
+ )))
+
+
+@istest
+def when_initials_are_blank_then_comment_author_label_is_comment():
+ assert_equal("Comment", _comment_author_label(documents.comment(
+ comment_id="0",
+ body=[],
+ author_initials=None,
+ )))
+
+
def _paragraph_with_text(text):
return documents.paragraph(children=[_run_with_text(text)])