From 0eeab964d0373ecdbdd14b5c96b0ab6faaa18cad Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 23 Jan 2018 22:06:12 +0000 Subject: Generate relationships path from part path --- tests/docx/comments_xml_tests.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'tests/docx/comments_xml_tests.py') 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) -- cgit v1.2.3