aboutsummaryrefslogtreecommitdiff
path: root/tests/docx/comments_xml_tests.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2018-01-23 22:06:12 +0000
committerMichael Williamson <mike@zwobble.org>2018-01-23 22:06:12 +0000
commit0eeab964d0373ecdbdd14b5c96b0ab6faaa18cad (patch)
treeeb4adcb3e06509d0b4613bd0592bfd3030cfd680 /tests/docx/comments_xml_tests.py
parent93e07b02624f668aa9300c048cde05bb416dda35 (diff)
Generate relationships path from part path
Diffstat (limited to 'tests/docx/comments_xml_tests.py')
-rw-r--r--tests/docx/comments_xml_tests.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/docx/comments_xml_tests.py b/tests/docx/comments_xml_tests.py
index eb52c21..1d5dd8d 100644
--- a/tests/docx/comments_xml_tests.py
+++ b/tests/docx/comments_xml_tests.py
@@ -2,16 +2,16 @@ 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.comments_xml import read_comments_xml_element
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", {}, [
+ comments = read_comments_xml_element(xml_element("w:comments", {}, [
xml_element("w:comment", {"w:id": "1"}, body),
- ]))
+ ]), body_reader=body_xml.reader())
assert_equal(1, len(comments.value))
assert_equal(comments.value[0].body, [documents.paragraph(children=[])])
assert_equal("1", comments.value[0].comment_id)
@@ -19,9 +19,9 @@ def id_and_body_of_comment_is_read():
@istest
def when_optional_attributes_of_comment_are_missing_then_they_are_read_as_none():
- comments = create_comments_reader(body_xml.reader())(xml_element("w:comments", {}, [
+ comments = read_comments_xml_element(xml_element("w:comments", {}, [
xml_element("w:comment", {"w:id": "1"}, []),
- ]))
+ ]), body_reader=body_xml.reader())
comment, = comments.value
assert_equal(None, comment.author_name)
assert_equal(None, comment.author_initials)
@@ -29,9 +29,9 @@ def when_optional_attributes_of_comment_are_missing_then_they_are_read_as_none()
@istest
def when_optional_attributes_of_comment_are_blank_then_they_are_read_as_none():
- comments = create_comments_reader(body_xml.reader())(xml_element("w:comments", {}, [
+ comments = read_comments_xml_element(xml_element("w:comments", {}, [
xml_element("w:comment", {"w:id": "1", "w:author": " ", "w:initials": " "}, []),
- ]))
+ ]), body_reader=body_xml.reader())
comment, = comments.value
assert_equal(None, comment.author_name)
assert_equal(None, comment.author_initials)
@@ -39,9 +39,9 @@ def when_optional_attributes_of_comment_are_blank_then_they_are_read_as_none():
@istest
def when_optional_attributes_of_comment_are_not_blank_then_they_are_read():
- comments = create_comments_reader(body_xml.reader())(xml_element("w:comments", {}, [
+ comments = read_comments_xml_element(xml_element("w:comments", {}, [
xml_element("w:comment", {"w:id": "1", "w:author": "The Piemaker", "w:initials": "TP"}, []),
- ]))
+ ]), body_reader=body_xml.reader())
comment, = comments.value
assert_equal("The Piemaker", comment.author_name)
assert_equal("TP", comment.author_initials)