diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-12-01 13:28:57 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-12-01 13:28:57 +0000 |
| commit | 4a35a848117c4fe646d36419096d099030878469 (patch) | |
| tree | 9c83c8b8c0aee665311839477163776250db4b85 /tests | |
| parent | 8fc128a3e70465b82605b4c0bdb3d1a6ffe87ef6 (diff) | |
Add style_name to Run
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/docx/document_xml_tests.py | 13 | ||||
| -rw-r--r-- | tests/docx/docx_tests.py | 6 |
2 files changed, 12 insertions, 7 deletions
diff --git a/tests/docx/document_xml_tests.py b/tests/docx/document_xml_tests.py index b31ac9d..6539c54 100644 --- a/tests/docx/document_xml_tests.py +++ b/tests/docx/document_xml_tests.py @@ -17,7 +17,7 @@ class ReadXmlElementTests(object): def can_read_text_within_run(self): element = _run_element_with_text("Hello!") assert_equal( - documents.Run([documents.Text("Hello!")]), + documents.run([documents.Text("Hello!")]), read_document_xml_element(element) ) @@ -25,7 +25,7 @@ class ReadXmlElementTests(object): def can_read_text_within_paragraph(self): element = _paragraph_element_with_text("Hello!") assert_equal( - documents.paragraph([documents.Run([documents.Text("Hello!")])]), + documents.paragraph([documents.run([documents.Text("Hello!")])]), read_document_xml_element(element) ) @@ -33,7 +33,7 @@ class ReadXmlElementTests(object): def can_read_text_within_document(self): element = _document_element_with_text("Hello!") assert_equal( - documents.Document([documents.paragraph([documents.Run([documents.Text("Hello!")])])]), + documents.Document([documents.paragraph([documents.run([documents.Text("Hello!")])])]), read_document_xml_element(element) ) @@ -70,6 +70,11 @@ class ReadXmlElementTests(object): assert_equal("1", paragraph.numbering.level_index) assert_equal(True, paragraph.numbering.is_ordered) + @istest + def run_has_no_style_if_it_has_no_properties(self): + element = xml_element("w:r") + assert_equal(None, read_document_xml_element(element).style_name) + @istest def unrecognised_elements_are_ignored(self): @@ -80,7 +85,7 @@ class ReadXmlElementTests(object): def unrecognised_children_are_ignored(self): element = xml_element("w:r", {}, [_text_element("Hello!"), xml_element("w:huh", {}, [])]) assert_equal( - documents.Run([documents.Text("Hello!")]), + documents.run([documents.Text("Hello!")]), read_document_xml_element(element) ) diff --git a/tests/docx/docx_tests.py b/tests/docx/docx_tests.py index c20a41d..15bca51 100644 --- a/tests/docx/docx_tests.py +++ b/tests/docx/docx_tests.py @@ -10,10 +10,10 @@ class ReadTests(object): def can_read_document_with_single_paragraph_with_single_run_of_text(self): with open(test_path("single-paragraph.docx")) as fileobj: result = docx.read(fileobj=fileobj) - expected_document = documents.Document([ + expected_document = documents.document([ documents.paragraph([ - documents.Run([ - documents.Text("Walking on imported air") + documents.run([ + documents.text("Walking on imported air") ]) ]) ]) |
