Skip to content

Commit

Permalink
Add test for format of numbering level without explicit format
Browse files Browse the repository at this point in the history
  • Loading branch information
mwilliamson committed Mar 20, 2024
1 parent 3930c76 commit 74d3543
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/docx/numbering_xml_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,27 @@ def test_list_is_not_ordered_if_formatted_as_bullet():
numbering = _read_numbering_xml_element(_sample_numbering_xml)
assert_equal(False, numbering.find_level("47", "0").is_ordered)


def test_list_is_ordered_if_formatted_as_decimal():
numbering = _read_numbering_xml_element(_sample_numbering_xml)
assert_equal(True, numbering.find_level("47", "1").is_ordered)


def test_list_is_ordered_if_there_is_no_explicit_format():
element = xml_element("w:numbering", {}, [
xml_element("w:abstractNum", {"w:abstractNumId": "42"}, [
xml_element("w:lvl", {"w:ilvl": "0"}),
]),
xml_element("w:num", {"w:numId": "47"}, [
xml_element("w:abstractNumId", {"w:val": "42"})
])
])

numbering = _read_numbering_xml_element(element)

assert_equal(True, numbering.find_level("47", "0").is_ordered)


def test_find_level_returns_none_if_level_cannot_be_found():
numbering = _read_numbering_xml_element(_sample_numbering_xml)
assert_equal(None, numbering.find_level("47", "2"))
Expand Down

0 comments on commit 74d3543

Please sign in to comment.