diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-07-03 12:16:50 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-07-03 12:16:50 +0100 |
| commit | 05d9ac1031dcf83c6d99fa2218ee45a6d7b4d746 (patch) | |
| tree | c03911389cf037c2f71c55cf450647939e7710b4 /tests/docx/comments_xml_tests.py | |
| parent | af8cdba7bd607c85a67148af99231975a892f5e2 (diff) | |
Add reader for comments.xml
Diffstat (limited to 'tests/docx/comments_xml_tests.py')
| -rw-r--r-- | tests/docx/comments_xml_tests.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/docx/comments_xml_tests.py b/tests/docx/comments_xml_tests.py new file mode 100644 index 0000000..2970922 --- /dev/null +++ b/tests/docx/comments_xml_tests.py @@ -0,0 +1,18 @@ +from nose.tools import istest, assert_equal + +from mammoth import documents +from mammoth.docx.xmlparser import element as xml_element +from mammoth.docx.comments_xml import create_comments_reader +from mammoth.docx import body_xml + + +@istest +def id_and_body_of_comment_is_read(): + body = [xml_element("w:p")] + comments = create_comments_reader(body_xml.reader())(xml_element("w:comments", {}, [ + xml_element("w:comment", {"w:id": "1"}, body), + ])) + assert_equal(1, len(comments.value)) + assert_equal(comments.value[0].body, [documents.paragraph(children=[])]) + assert_equal("1", comments.value[0].comment_id) + |
