diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-09-26 22:03:51 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-09-26 22:03:51 +0100 |
| commit | aa2253a10d92a07af74e96a04568734dc4c197f1 (patch) | |
| tree | a2108ca32327e29e9d1d4259f319e3d1b68b56fc /tests/docx | |
| parent | b582d776915c380dc7518d2586edb6cb9a7423cf (diff) | |
Handle paragraphs and runs that have been moved and tracked as a revision
Diffstat (limited to 'tests/docx')
| -rw-r--r-- | tests/docx/body_xml_tests.py | 33 |
1 files changed, 33 insertions, 0 deletions
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) |
