diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-05-11 18:01:31 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-05-11 18:01:31 +0100 |
| commit | 61e88321b9e5dc67a0373edc69f8114db8c1d3b7 (patch) | |
| tree | 3f43fd006b6c095f91c2424086b273928881336c /tests | |
| parent | 7e57058cf120717cc2d2fea3b897b12c3891b28a (diff) | |
Rename existing concept of style names to style IDs to match docx
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/conversion_tests.py | 10 | ||||
| -rw-r--r-- | tests/docx/document_xml_tests.py | 12 | ||||
| -rw-r--r-- | tests/mammoth_tests.py | 2 | ||||
| -rw-r--r-- | tests/style_reader_tests.py | 8 |
4 files changed, 16 insertions, 16 deletions
diff --git a/tests/conversion_tests.py b/tests/conversion_tests.py index 5912a0e..edc8bb6 100644 --- a/tests/conversion_tests.py +++ b/tests/conversion_tests.py @@ -37,7 +37,7 @@ def empty_paragraphs_are_ignored(): @istest def paragraphs_are_converted_by_satisfying_matching_paths(): result = convert_document_element_to_html( - documents.paragraph(style_name="TipsParagraph", children=[ + documents.paragraph(style_id="TipsParagraph", children=[ _run_with_text("Tip") ]), style_map=[ @@ -50,7 +50,7 @@ def paragraphs_are_converted_by_satisfying_matching_paths(): @istest def default_paragraph_style_is_used_if_no_matching_style_is_found(): result = convert_document_element_to_html( - documents.paragraph(style_name="TipsParagraph", children=[ + documents.paragraph(style_id="TipsParagraph", children=[ _run_with_text("Tip") ]), ) @@ -60,7 +60,7 @@ def default_paragraph_style_is_used_if_no_matching_style_is_found(): @istest def default_paragraph_style_is_specified_by_mapping_plain_paragraphs(): result = convert_document_element_to_html( - documents.paragraph(style_name="TipsParagraph", children=[ + documents.paragraph(style_id="TipsParagraph", children=[ _run_with_text("Tip") ]), style_map=[ @@ -73,7 +73,7 @@ def default_paragraph_style_is_specified_by_mapping_plain_paragraphs(): @istest def warning_is_emitted_if_paragraph_style_is_unrecognised(): result = convert_document_element_to_html( - documents.paragraph(style_name="TipsParagraph", children=[ + documents.paragraph(style_id="TipsParagraph", children=[ _run_with_text("Tip") ]), ) @@ -133,7 +133,7 @@ def italic_runs_are_wrapped_in_emphasis_tags(): @istest def runs_are_converted_by_satisfying_matching_paths(): result = convert_document_element_to_html( - documents.run(style_name="TipsRun", children=[documents.Text("Tip")]), + documents.run(style_id="TipsRun", children=[documents.Text("Tip")]), style_map=[ style_reader.read_style("r.TipsRun => span.tip") ] diff --git a/tests/docx/document_xml_tests.py b/tests/docx/document_xml_tests.py index caeaeb8..e63cd60 100644 --- a/tests/docx/document_xml_tests.py +++ b/tests/docx/document_xml_tests.py @@ -44,15 +44,15 @@ class ReadXmlElementTests(object): @istest def paragraph_has_no_style_if_it_has_no_properties(self): element = xml_element("w:p") - assert_equal(None, _read_and_get_document_xml_element(element).style_name) + assert_equal(None, _read_and_get_document_xml_element(element).style_id) @istest - def paragraph_has_style_name_read_from_paragraph_properties_if_present(self): + def paragraph_has_style_id_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 = _read_and_get_document_xml_element(paragraph_xml) - assert_equal("Heading1", paragraph.style_name) + assert_equal("Heading1", paragraph.style_id) @istest def paragraph_has_no_numbering_if_it_has_no_numbering_properties(self): @@ -77,13 +77,13 @@ class ReadXmlElementTests(object): @istest def run_has_no_style_if_it_has_no_properties(self): element = xml_element("w:r") - assert_equal(None, _read_and_get_document_xml_element(element).style_name) + assert_equal(None, _read_and_get_document_xml_element(element).style_id) @istest - def run_has_style_name_read_from_run_properties_if_present(self): + def run_has_style_id_read_from_run_properties_if_present(self): style_xml = xml_element("w:rStyle", {"w:val": "Emphasis"}) run = self._read_run_with_properties([style_xml]) - assert_equal("Emphasis", run.style_name) + assert_equal("Emphasis", run.style_id) @istest def run_is_not_bold_if_bold_element_is_not_present(self): diff --git a/tests/mammoth_tests.py b/tests/mammoth_tests.py index 77e7ec2..bc9f99c 100644 --- a/tests/mammoth_tests.py +++ b/tests/mammoth_tests.py @@ -32,7 +32,7 @@ def simple_list_is_converted_to_list_elements(): @istest def transform_document_is_applied_to_document_before_conversion(): def transform_document(document): - document.children[0].style_name = "Heading1" + document.children[0].style_id = "Heading1" return document with open(test_path("single-paragraph.docx"), "rb") as fileobj: diff --git a/tests/style_reader_tests.py b/tests/style_reader_tests.py index 32636db..21b857e 100644 --- a/tests/style_reader_tests.py +++ b/tests/style_reader_tests.py @@ -72,9 +72,9 @@ class ReadDocumentMatcherTests(object): @istest - def reads_paragraph_with_style_name(self): + def reads_paragraph_with_style_id(self): assert_equal( - document_matchers.paragraph(style_name="Heading1"), + document_matchers.paragraph(style_id="Heading1"), read_document_matcher("p.Heading1") ) @@ -104,9 +104,9 @@ class ReadDocumentMatcherTests(object): @istest - def reads_run_with_style_name(self): + def reads_run_with_style_id(self): assert_equal( - document_matchers.run(style_name="Emphasis"), + document_matchers.run(style_id="Emphasis"), read_document_matcher("r.Emphasis") ) |
