aboutsummaryrefslogtreecommitdiff
path: root/tests/docx/numbering_xml_tests.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2022-11-25 22:50:05 +0000
committerMichael Williamson <mike@zwobble.org>2022-11-25 22:58:16 +0000
commit5093d72b9fece1a7c3d7a3d19e4161387ee6475a (patch)
treec4122b0f72c7864897d78333e75328ac8c22685b /tests/docx/numbering_xml_tests.py
parent20e3e61530bef546058124c3015ae240733cc974 (diff)
Use pytest instead of nose
Diffstat (limited to 'tests/docx/numbering_xml_tests.py')
-rw-r--r--tests/docx/numbering_xml_tests.py27
1 files changed, 9 insertions, 18 deletions
diff --git a/tests/docx/numbering_xml_tests.py b/tests/docx/numbering_xml_tests.py
index 6c1d843..b6959a6 100644
--- a/tests/docx/numbering_xml_tests.py
+++ b/tests/docx/numbering_xml_tests.py
@@ -1,12 +1,10 @@
-from nose.tools import istest, assert_equal
-
from mammoth.docx.xmlparser import element as xml_element
from mammoth.docx.numbering_xml import read_numbering_xml_element
from mammoth.docx.styles_xml import NumberingStyle, Styles
+from ..testing import assert_equal
-@istest
-def find_level_returns_none_if_num_with_id_cannot_be_found():
+def test_find_level_returns_none_if_num_with_id_cannot_be_found():
numbering = _read_numbering_xml_element(xml_element("w:numbering"))
assert_equal(None, numbering.find_level("47", "0"))
@@ -26,32 +24,27 @@ _sample_numbering_xml = xml_element("w:numbering", {}, [
])
-@istest
-def level_includes_level_index():
+def test_level_includes_level_index():
numbering = _read_numbering_xml_element(_sample_numbering_xml)
assert_equal("0", numbering.find_level("47", "0").level_index)
assert_equal("1", numbering.find_level("47", "1").level_index)
-@istest
-def list_is_not_ordered_if_formatted_as_bullet():
+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)
-@istest
-def list_is_ordered_if_formatted_as_decimal():
+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)
-@istest
-def find_level_returns_none_if_level_cannot_be_found():
+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"))
-@istest
-def num_referencing_non_existent_abstract_num_is_ignored():
+def test_num_referencing_non_existent_abstract_num_is_ignored():
element = xml_element("w:numbering", {}, [
xml_element("w:num", {"w:numId": "47"}, [
xml_element("w:abstractNumId", {"w:val": "42"})
@@ -63,8 +56,7 @@ def num_referencing_non_existent_abstract_num_is_ignored():
assert_equal(None, numbering.find_level("47", "0"))
-@istest
-def when_abstract_num_has_num_style_link_then_style_is_used_to_find_num():
+def test_when_abstract_num_has_num_style_link_then_style_is_used_to_find_num():
numbering = _read_numbering_xml_element(
xml_element("w:numbering", {}, [
xml_element("w:abstractNum", {"w:abstractNumId": "100"}, [
@@ -88,8 +80,7 @@ def when_abstract_num_has_num_style_link_then_style_is_used_to_find_num():
# See: 17.9.23 pStyle (Paragraph Style's Associated Numbering Level) in ECMA-376, 4th Edition
-@istest
-def numbering_level_can_be_found_by_paragraph_style_id():
+def test_numbering_level_can_be_found_by_paragraph_style_id():
numbering = _read_numbering_xml_element(
xml_element("w:numbering", {}, [
xml_element("w:abstractNum", {"w:abstractNumId": "42"}, [