summaryrefslogtreecommitdiff
path: root/tests
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
parent93e07b02624f668aa9300c048cde05bb416dda35 (diff)
Generate relationships path from part path
Diffstat (limited to 'tests')
-rw-r--r--tests/docx/comments_xml_tests.py18
-rw-r--r--tests/docx/notes_xml_tests.py10
2 files changed, 14 insertions, 14 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)
diff --git a/tests/docx/notes_xml_tests.py b/tests/docx/notes_xml_tests.py
index b912991..56a7681 100644
--- a/tests/docx/notes_xml_tests.py
+++ b/tests/docx/notes_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.notes_xml import create_footnotes_reader
+from mammoth.docx.notes_xml import read_footnotes_xml_element
from mammoth.docx import body_xml
@istest
def id_and_body_of_footnote_are_read():
footnote_body = [xml_element("w:p")]
- footnotes = create_footnotes_reader(body_xml.reader())(xml_element("w:footnotes", {}, [
+ footnotes = read_footnotes_xml_element(xml_element("w:footnotes", {}, [
xml_element("w:footnote", {"w:id": "1"}, footnote_body),
- ]))
+ ]), body_reader=body_xml.reader())
assert_equal(1, len(footnotes.value))
assert isinstance(footnotes.value[0].body[0], documents.Paragraph)
assert_equal("1", footnotes.value[0].note_id)
@@ -29,8 +29,8 @@ def separator_is_ignored():
def _assert_footnote_type_is_ignored(footnote_type):
footnote_body = [xml_element("w:p")]
- footnotes = create_footnotes_reader(None)(xml_element("w:footnotes", {}, [
+ footnotes = read_footnotes_xml_element(xml_element("w:footnotes", {}, [
xml_element("w:footnote", {"w:id": "1", "w:type": footnote_type}, footnote_body),
- ]))
+ ]), body_reader=None)
assert_equal(0, len(footnotes.value))