diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-07-03 15:32:20 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-07-03 15:32:20 +0100 |
| commit | 92b00aeb4c1d0ab49507cbd4ad9a25e30a1ac724 (patch) | |
| tree | 0c77b0fba6fd16bfd74979ebf21532361d3c816c /tests | |
| parent | b249ef56971405e7b1d0b4bb3b9cfb4e779583ab (diff) | |
Handle comments without initials
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/conversion_tests.py | 20 |
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)]) |
