aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2017-04-03 18:31:03 +0100
committerMichael Williamson <mike@zwobble.org>2017-04-03 18:31:03 +0100
commitdbcb7129f21201a41ac0c41657e31b0c21b5f724 (patch)
tree6c450d0386641e1747339fb72c788299e6f81efc /tests
parent495b10c1218773f13d64643f018dc3a2497f22cd (diff)
Read alignment for paragraphs
Diffstat (limited to 'tests')
-rw-r--r--tests/docx/body_xml_tests.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/docx/body_xml_tests.py b/tests/docx/body_xml_tests.py
index 98296a1..5964acd 100644
--- a/tests/docx/body_xml_tests.py
+++ b/tests/docx/body_xml_tests.py
@@ -77,6 +77,20 @@ class ParagraphTests(object):
assert_equal([results.warning("Paragraph style with ID Heading1 was referenced but not defined in the document")], result.messages)
@istest
+ def paragraph_has_no_justification_if_it_has_no_justificiation_properties(self):
+ paragraph_xml = xml_element("w:p")
+ paragraph = _read_and_get_document_xml_element(paragraph_xml)
+ assert_equal(None, paragraph.alignment)
+
+ @istest
+ def paragraph_has_justification_read_from_paragraph_properties_if_present(self):
+ justification_xml = xml_element("w:jc", {"w:val": "center"})
+ properties_xml = xml_element("w:pPr", {}, [justification_xml])
+ paragraph_xml = xml_element("w:p", {}, [properties_xml])
+ paragraph = _read_and_get_document_xml_element(paragraph_xml)
+ assert_equal("center", paragraph.alignment)
+
+ @istest
def paragraph_has_no_numbering_if_it_has_no_numbering_properties(self):
element = xml_element("w:p")
assert_equal(None, _read_and_get_document_xml_element(element).numbering)