From aa2253a10d92a07af74e96a04568734dc4c197f1 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 26 Sep 2026 22:03:51 +0100 Subject: Handle paragraphs and runs that have been moved and tracked as a revision --- tests/docx/body_xml_tests.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'tests') diff --git a/tests/docx/body_xml_tests.py b/tests/docx/body_xml_tests.py index 1bce6e1..58a036f 100644 --- a/tests/docx/body_xml_tests.py +++ b/tests/docx/body_xml_tests.py @@ -1292,6 +1292,21 @@ def test_children_of_w_custom_xml_are_converted_normally(): def test_children_of_w_ins_are_converted_normally(): _assert_children_are_converted_normally("w:ins") +def test_children_of_w_move_from_range_end_are_converted_normally(): + _assert_children_are_converted_normally("w:moveFromRangeEnd") + +def test_children_of_w_move_from_range_start_are_converted_normally(): + _assert_children_are_converted_normally("w:moveFromRangeStart") + +def test_children_of_w_move_to_are_converted_normally(): + _assert_children_are_converted_normally("w:moveTo") + +def test_children_of_w_move_to_range_end_are_converted_normally(): + _assert_children_are_converted_normally("w:moveToRangeEnd") + +def test_children_of_w_move_to_range_start_are_converted_normally(): + _assert_children_are_converted_normally("w:moveToRangeStart") + def test_children_of_w_object_are_converted_normally(): _assert_children_are_converted_normally("w:object") @@ -1751,6 +1766,24 @@ def test_text_nodes_are_ignored_when_reading_children(): _read_and_get_document_xml_element(element) ) + +def test_w_move_from_elements_are_ignored(): + _assert_element_is_ignored("w:moveFrom") + + +def _assert_element_is_ignored(tag_name): + element = xml_element(tag_name, {}, [ + xml_element("w:r", {}, [ + xml_element("w:t", {}, [xml_text("Blackdown")]) + ]) + ]) + + assert_equal( + [], + _read_and_get_document_xml_elements(element) + ) + + def _read_and_get_document_xml_element(element, **kwargs): elements = _read_and_get_document_xml_elements(element, **kwargs) return single(elements) -- cgit v1.2.3