From 414f1cdd630de5a157dd54d3edd4da17bf313b49 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 18 Feb 2024 11:06:11 +0000 Subject: Remove redundant test --- tests/docx/document_xml_tests.py | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) (limited to 'tests/docx/document_xml_tests.py') diff --git a/tests/docx/document_xml_tests.py b/tests/docx/document_xml_tests.py index f869749..0d57fcf 100644 --- a/tests/docx/document_xml_tests.py +++ b/tests/docx/document_xml_tests.py @@ -8,14 +8,16 @@ from ..testing import assert_equal def test_when_body_element_is_present_then_body_is_read(): - paragraph_xml = xml_element("w:p", {}, []) + text_xml = xml_element("w:t", {}, [xml_text("Hello!")]) + run_xml = xml_element("w:r", {}, [text_xml]) + paragraph_xml = xml_element("w:p", {}, [run_xml]) body_xml = xml_element("w:body", {}, [paragraph_xml]) document_xml = xml_element("w:document", {}, [body_xml]) document = _read_and_get_document_xml_element(document_xml) assert_equal( - documents.document([documents.paragraph([])]), + documents.document([documents.paragraph([documents.run([documents.text("Hello!")])])]), document ) @@ -30,14 +32,6 @@ def test_when_body_element_is_not_present_then_error_is_raised(): assert_equal(str(error.value), "Could not find the body element: are you sure this is a docx file?") -def test_can_read_text_within_document(): - element = _document_element_with_text("Hello!") - assert_equal( - documents.document([documents.paragraph([documents.run([documents.Text("Hello!")])])]), - _read_and_get_document_xml_element(element) - ) - - def test_footnotes_of_document_are_read(): notes = [documents.note("footnote", "4", [documents.paragraph([])])] @@ -55,19 +49,3 @@ def _read_and_get_document_xml_element(*args, **kwargs): result = read_document_xml_element(*args, body_reader=body_reader, **kwargs) assert_equal([], result.messages) return result.value - - -def _document_element_with_text(text): - return xml_element("w:document", {}, [ - xml_element("w:body", {}, [_paragraph_element_with_text(text)]) - ]) - -def _paragraph_element_with_text(text): - return xml_element("w:p", {}, [_run_element_with_text(text)]) - -def _run_element_with_text(text): - return xml_element("w:r", {}, [_text_element(text)]) - - -def _text_element(value): - return xml_element("w:t", {}, [xml_text(value)]) -- cgit v1.2.3