summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-12-01 11:33:58 +0000
committerMichael Williamson <mike@zwobble.org>2013-12-01 11:33:58 +0000
commit8d1cc0932083a686e24ff02c9819e507fbb2cb9f (patch)
tree224a71cad9fc8276ef126fbfb2c16ed933190ce9 /tests
parentdc381b5afcae0994094d49465142e6099dcec86c (diff)
Read style from paragraph properties
Diffstat (limited to 'tests')
-rw-r--r--tests/docx_tests.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/docx_tests.py b/tests/docx_tests.py
index 80253fa..792ff14 100644
--- a/tests/docx_tests.py
+++ b/tests/docx_tests.py
@@ -55,6 +55,14 @@ class ReadXmlElementTests(object):
def paragraph_has_no_style_if_it_has_no_properties(self):
element = xml_element("w:p")
assert_equal(None, docx.read_xml_element(element).style_name)
+
+ @istest
+ def paragraph_has_style_name_read_from_paragraph_properties_if_present(self):
+ style_xml = xml_element("w:pStyle", {"w:val": "Heading1"})
+ properties_xml = xml_element("w:pPr", {}, [style_xml])
+ paragraph_xml = xml_element("w:p", {}, [properties_xml])
+ paragraph = docx.read_xml_element(paragraph_xml)
+ assert_equal("Heading1", paragraph.style_name)
@istest
def unrecognised_elements_are_ignored(self):