aboutsummaryrefslogtreecommitdiff
path: root/tests/docx
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-08-09 14:57:34 +0100
committerMichael Williamson <mike@zwobble.org>2026-08-09 14:57:34 +0100
commit9d73a4b20a5bb24919697e29d221fdc6c9b50c13 (patch)
tree1d86b6e609f34c3ec21ac9eda59bd011d3c7e027 /tests/docx
parent32f3d9fae7ad0a4ad7cc9c74d81a6fd670912fbe (diff)
Ignore numbering levels that use numStyleLink to refer to themselves
Diffstat (limited to 'tests/docx')
-rw-r--r--tests/docx/numbering_xml_tests.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/docx/numbering_xml_tests.py b/tests/docx/numbering_xml_tests.py
index 6cc779f..52aad5d 100644
--- a/tests/docx/numbering_xml_tests.py
+++ b/tests/docx/numbering_xml_tests.py
@@ -154,6 +154,23 @@ def test_when_abstract_num_has_num_style_link_then_style_is_used_to_find_num():
assert_equal(True, numbering.find_level("201", "0").is_ordered)
+def test_when_abstract_num_has_self_recursive_num_style_link_then_level_is_not_found():
+ numbering = _read_numbering_xml_element(
+ xml_element("w:numbering", {}, [
+ xml_element("w:abstractNum", {"w:abstractNumId": "100"}, [
+ xml_element("w:numStyleLink", {"w:val": "List1"}),
+ ]),
+ xml_element("w:num", {"w:numId": "200"}, [
+ xml_element("w:abstractNumId", {"w:val": "100"}),
+ ]),
+ ]),
+ styles=Styles.create(numbering_styles={
+ "List1": NumberingStyle(style_id="List1", num_id="200"),
+ }),
+ )
+ assert_equal(None, numbering.find_level("200", "0"))
+
+
# See: 17.9.23 pStyle (Paragraph Style's Associated Numbering Level) in ECMA-376, 4th Edition
def test_numbering_level_can_be_found_by_paragraph_style_id():
numbering = _read_numbering_xml_element(